pub struct LedEffect<C: Clock> { /* private fields */ }
Expand description
LED Effect instance
Stores some additional metadata alongside with the effect type used during the effect processing.
Implementations§
Source§impl<C: Clock> LedEffect<C>
impl<C: Clock> LedEffect<C>
Sourcepub fn new(fx_type: EffectType<C::T>) -> Self
pub fn new(fx_type: EffectType<C::T>) -> Self
Create new LED Effect instance with the assigned effect type
Sourcepub fn has_started(&self) -> bool
pub fn has_started(&self) -> bool
Indicates whether the effect has started
Sourcepub fn started_at(&self) -> Option<Instant<C>>
pub fn started_at(&self) -> Option<Instant<C>>
Get the timestamp at which the effect started
Sourcepub fn set_started_at(&mut self, now: Instant<C>)
pub fn set_started_at(&mut self, now: Instant<C>)
Sets the effect start point
This should be only called by the poll functions of [Led
] implementations
Sourcepub fn get_type(&self) -> &EffectType<C::T>
pub fn get_type(&self) -> &EffectType<C::T>
Returns the effect type of this LED effect instance
Sourcepub fn get_duration(&self) -> Option<Milliseconds<C::T>>
pub fn get_duration(&self) -> Option<Milliseconds<C::T>>
Returns the duration for which the effect should last
Sourcepub fn set_duration(&mut self, dur: Milliseconds<C::T>)
pub fn set_duration(&mut self, dur: Milliseconds<C::T>)
Sets the effect duration
Sourcepub fn time_elapsed(&self, now: Instant<C>) -> Option<Milliseconds<C::T>>
pub fn time_elapsed(&self, now: Instant<C>) -> Option<Milliseconds<C::T>>
Returns elapsed duration since the effect has started
Sourcepub fn current_cycle_duration(
&self,
now: Instant<C>,
) -> Option<Milliseconds<C::T>>
pub fn current_cycle_duration( &self, now: Instant<C>, ) -> Option<Milliseconds<C::T>>
Returns the duration of current cycle
Sourcepub fn start_new_cycle(&mut self, now: Instant<C>)
pub fn start_new_cycle(&mut self, now: Instant<C>)
Start new cycle at an timestamp
Trait Implementations§
impl<C: Copy + Clock> Copy for LedEffect<C>
Auto Trait Implementations§
impl<C> Freeze for LedEffect<C>
impl<C> RefUnwindSafe for LedEffect<C>
impl<C> Send for LedEffect<C>
impl<C> Sync for LedEffect<C>
impl<C> Unpin for LedEffect<C>
impl<C> UnwindSafe for LedEffect<C>
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