diff options
| author | Irene Knapp <ireneista@irenes.space> | 2026-11-18 16:38:51 -0700 |
|---|---|---|
| committer | Irene Knapp <ireneista@irenes.space> | 2026-11-18 16:38:51 -0700 |
| commit | dcf0c6ce5ce21647640b2b35715ede50a5a97881 (patch) | |
| tree | 7cf9e269511074553181883df16a4b1e6269bb37 /src/module/time.rs | |
| parent | 0bcfe7b468a83436a077824ca60e09c5fdd3f803 (diff) | |
dyn Module
fun this also seemed a good time to clean up the bibliography and publish it Force-Push: yes Change-Id: Ia8014fb84c1af37be4f3c915b8b8f70bc2022034
Diffstat (limited to 'src/module/time.rs')
| -rw-r--r-- | src/module/time.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/module/time.rs b/src/module/time.rs index f334fd0..0388f62 100644 --- a/src/module/time.rs +++ b/src/module/time.rs @@ -1,8 +1,7 @@ use crate::error::Result; use crate::facility::FacilityType; -use crate::module::Module; +use crate::module::{ CreatableModule, Module }; -use std::sync::{ Arc, Mutex }; use std::time::Duration; use time::OffsetDateTime; @@ -15,22 +14,24 @@ pub struct TimeModule { } -impl Module for TimeModule { +impl CreatableModule for TimeModule { const REQUIRED_FACILITIES: FacilityType = FacilityType::empty(); - fn new() -> Result<Arc<Mutex<TimeModule>>> { + fn new() -> Result<TimeModule> { let format_string = "[weekday repr:short] [year]-[month]-[day] ".to_owned() + "[hour repr:24]:[minute]:[second]"; let time_format = parse_owned::<3>(&format_string).unwrap(); - Ok(Arc::new(Mutex::new(TimeModule { + Ok(TimeModule { time_format, most_recent_report: None, - }))) + }) } +} +impl Module for TimeModule { fn format(&mut self) -> String { let time = OffsetDateTime::now_local().unwrap(); |