[−][src]Struct blinq::Pattern
A blinking pattern encoded as a u32
These patterns are used with a Blinq
Implementations
impl Pattern
[src]
pub const fn from_u32(pattern: u32, used: u8) -> Self
[src]
Create a new pattern from a u32
Note: if used
is larger than 32, it will cause a compile time error.
In the future this will silently truncate to 32.
Example
use blinq::Pattern; // This is a blink with a 25% on, 75% off duty cycle let on_off = Pattern::from_u32(0b1000, 4);
pub const fn append(&self, other: &Pattern) -> Pattern
[src]
Create new pattern by appending one to the other
Note: If self.used + other.used is greater than 32, the pattern will be truncated. If self.used is greater than 32, this will fail to compile. In the future, this will silently truncate to 32.
Example
use blinq::Pattern; // This is on for a single step let on = Pattern::from_u32(0b1, 1); // This is off for three steps let off = Pattern::from_u32(0b000, 3); // This is on for a single step, then off for 3 let on_off = on.append(&off);
pub const fn reverse(&self) -> Pattern
[src]
Reverse the bit pattern, keeping the same length
Example
use blinq::Pattern; // This is a blink with a 25% on, 75% off duty cycle let on_off = Pattern::from_u32(0b1000, 4); // This is a blink with a 75% off, 25% on duty cycle let off_on = on_off.reverse();
Trait Implementations
impl Clone for Pattern
[src]
fn clone(&self) -> Pattern
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,