pub struct SleepController { /* private fields */ }Expand description
The main sleep controller
Implementations§
Source§impl SleepController
impl SleepController
Sourcepub fn with_config(config: SleepConfig) -> Self
pub fn with_config(config: SleepConfig) -> Self
Create with custom configuration
Sourcepub fn step(&mut self, dt_minutes: f64) -> Vec<SleepEvent>
pub fn step(&mut self, dt_minutes: f64) -> Vec<SleepEvent>
Step the sleep simulation forward
Sourcepub fn fall_asleep(&mut self) -> Result<()>
pub fn fall_asleep(&mut self) -> Result<()>
Initiate sleep
Sourcepub fn current_stage(&self) -> SleepStage
pub fn current_stage(&self) -> SleepStage
Get current stage
Sourcepub fn current_cycle(&self) -> usize
pub fn current_cycle(&self) -> usize
Get current cycle
Sourcepub fn sleep_pressure(&self) -> f64
pub fn sleep_pressure(&self) -> f64
Get sleep pressure
Sourcepub fn total_sleep_time(&self) -> f64
pub fn total_sleep_time(&self) -> f64
Get total sleep time
Sourcepub fn time_awake(&self) -> f64
pub fn time_awake(&self) -> f64
Get time awake
Sourcepub fn should_sleep(&self) -> bool
pub fn should_sleep(&self) -> bool
Check if should fall asleep (based on pressure and circadian)
Sourcepub fn stats(&self) -> SleepStats
pub fn stats(&self) -> SleepStats
Get sleep statistics
Sourcepub fn add_memories(&mut self, memories: Vec<Vec<f64>>)
pub fn add_memories(&mut self, memories: Vec<Vec<f64>>)
Add memories to consolidate
Sourcepub fn get_consolidated(&self) -> Vec<Vec<f64>>
pub fn get_consolidated(&self) -> Vec<Vec<f64>>
Get consolidated memories
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SleepController
impl RefUnwindSafe for SleepController
impl Send for SleepController
impl Sync for SleepController
impl Unpin for SleepController
impl UnwindSafe for SleepController
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