pub struct Config {
pub year: i32,
pub month: u32,
pub day: u32,
pub city: String,
pub country: String,
pub get_type: GetType,
}Fields§
§year: i32§month: u32§day: u32§city: String§country: String§get_type: GetTypeImplementations§
Source§impl Config
impl Config
Sourcepub fn new(
year: i32,
month: u32,
day: u32,
city: String,
country: String,
get_type: GetType,
) -> Config
pub fn new( year: i32, month: u32, day: u32, city: String, country: String, get_type: GetType, ) -> Config
Examples found in repository?
examples/main.rs (lines 11-18)
9fn main() {
10 let today = chrono::Local::now();
11 let config = Config::new(
12 today.year(),
13 today.month(),
14 today.day(),
15 "mecca".to_string(),
16 "SAU".to_string(),
17 neda_lib::core::config::GetType::Month,
18 );
19 let aladhan = AladhanProvider::new(config.clone());
20 let prayers_times = aladhan.get_prayers_times(&config).unwrap();
21 // println!("prayers_times is: {:#?}", prayers_times);
22
23 let db = PrayersTimesDB::new("lib/local.db".to_string());
24 match db {
25 Ok(mut db) => {
26 match db.push(&prayers_times) {
27 Ok(_) => {
28 println!("ignore pushing to the db");
29 }
30 _ => {
31 println!("pushing to the db");
32 }
33 };
34
35 let day_salawat = db.get_day_times(&prayers_times.from).unwrap();
36 let fjer = db.get_prayer_time(Prayers::Fajr, &prayers_times.from);
37 println!("fjer is: {:#?}", fjer);
38 println!("day salawat is: {:#?}", day_salawat);
39 // let's run the adhan now
40 let adhan = Adhan::new("lib/examples/audio/اذان-احمد-النفيس.mp3".to_string());
41 adhan.play();
42 }
43 Err(e) => {
44 println!("Error: {:#?}", e);
45 }
46 }
47}Sourcepub fn clone(&self) -> Config
pub fn clone(&self) -> Config
Examples found in repository?
examples/main.rs (line 19)
9fn main() {
10 let today = chrono::Local::now();
11 let config = Config::new(
12 today.year(),
13 today.month(),
14 today.day(),
15 "mecca".to_string(),
16 "SAU".to_string(),
17 neda_lib::core::config::GetType::Month,
18 );
19 let aladhan = AladhanProvider::new(config.clone());
20 let prayers_times = aladhan.get_prayers_times(&config).unwrap();
21 // println!("prayers_times is: {:#?}", prayers_times);
22
23 let db = PrayersTimesDB::new("lib/local.db".to_string());
24 match db {
25 Ok(mut db) => {
26 match db.push(&prayers_times) {
27 Ok(_) => {
28 println!("ignore pushing to the db");
29 }
30 _ => {
31 println!("pushing to the db");
32 }
33 };
34
35 let day_salawat = db.get_day_times(&prayers_times.from).unwrap();
36 let fjer = db.get_prayer_time(Prayers::Fajr, &prayers_times.from);
37 println!("fjer is: {:#?}", fjer);
38 println!("day salawat is: {:#?}", day_salawat);
39 // let's run the adhan now
40 let adhan = Adhan::new("lib/examples/audio/اذان-احمد-النفيس.mp3".to_string());
41 adhan.play();
42 }
43 Err(e) => {
44 println!("Error: {:#?}", e);
45 }
46 }
47}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more