Struct PulseDuration
pub struct PulseDuration {
keep_negative: bool,
polarity: PulsePolarity,
last: Option<(DateTime<Utc>, bool)>,
}Expand description
Mutable step that outputs the duration of a pulse.
This step operates on boolean values and will explicitly cast non-boolean values to boolean using whalesong::Value::cast_boolean_value.
A pulse is a contiguous period of time where the boolean value remains the same. You can explicitly select whether you only want to consider the “high”, “low”, or both pulses.
To better illustrate the concept of a pulse, here’s an illustration:
true /---------\ /---------\
| | | |
false __/ \_________/ |
^ ^ ^ ^
t0 t1 t2 t3There are three pulses in the above example:
Fields§
§keep_negative: bool§polarity: PulsePolarity§last: Option<(DateTime<Utc>, bool)>Implementations§
§impl PulseDuration
impl PulseDuration
pub const fn new() -> Self
pub const fn new() -> Self
Creates a new instance.
pub const fn with_keep_negative(self, keep_negative: bool) -> Self
pub const fn with_keep_negative(self, keep_negative: bool) -> Self
Configures whether to emit negative durations.
By default, negative durations are dropped.
pub const fn with_polarity(self, polarity: PulsePolarity) -> Self
pub const fn with_polarity(self, polarity: PulsePolarity) -> Self
Configures the pulse polarity.
By default, only “high” pulses are considered.
Trait Implementations§
§impl Clone for PulseDuration
impl Clone for PulseDuration
§fn clone(&self) -> PulseDuration
fn clone(&self) -> PulseDuration
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for PulseDuration
impl Debug for PulseDuration
§impl Default for PulseDuration
impl Default for PulseDuration
§impl From<PulseDuration> for AnyStepMut
impl From<PulseDuration> for AnyStepMut
§fn from(step: PulseDuration) -> Self
fn from(step: PulseDuration) -> Self
Converts to this type from the input type.
§impl StepMut for PulseDuration
impl StepMut for PulseDuration
Auto Trait Implementations§
impl Freeze for PulseDuration
impl RefUnwindSafe for PulseDuration
impl Send for PulseDuration
impl Sync for PulseDuration
impl Unpin for PulseDuration
impl UnwindSafe for PulseDuration
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