using rocket instead of astro

This commit is contained in:
Philippe Loctaux 2023-12-01 10:54:31 +01:00
parent eb72400722
commit e61ef1d4c3
79 changed files with 4406 additions and 8501 deletions

50
src/types.rs Normal file
View file

@ -0,0 +1,50 @@
use rocket::http::uri::Absolute;
pub mod friend;
pub mod job;
pub mod network;
pub mod project;
pub mod talk;
pub use self::friend::*;
pub use self::job::*;
pub use self::network::*;
pub use self::project::*;
pub use self::talk::*;
pub use crate::wallpapers::WALLPAPERS;
pub struct Logo {
pub file: &'static str,
pub transparent_background: bool,
}
pub struct Link {
pub label: &'static str,
pub uri: Absolute<'static>,
}
pub struct Location {
pub precise: &'static str,
pub broad: &'static str,
pub latitude: f32,
pub longitude: f32,
}
pub struct Wallpaper {
pub file: &'static str,
pub date: &'static str,
pub location: Location,
}
impl Wallpaper {
pub fn random() -> Option<&'static &'static Wallpaper> {
use nanorand::{ChaCha20, Rng};
use std::ops::Range;
let range = Range {
start: 0,
end: WALLPAPERS.len(),
};
WALLPAPERS.get(ChaCha20::new().generate_range(range))
}
}