pub struct Adhan {
pub file: String,
}Fields§
§file: StringImplementations§
Source§impl Adhan
impl Adhan
Sourcepub fn new(file: String) -> Self
pub fn new(file: String) -> Self
Examples found in repository?
examples/main.rs (line 40)
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 play(&self)
pub fn play(&self)
Examples found in repository?
examples/main.rs (line 41)
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}Auto Trait Implementations§
impl Freeze for Adhan
impl RefUnwindSafe for Adhan
impl Send for Adhan
impl Sync for Adhan
impl Unpin for Adhan
impl UnsafeUnpin for Adhan
impl UnwindSafe for Adhan
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