Skip to main content

PresetState

Struct PresetState 

Source
pub struct PresetState<const B: usize = MAX_BUTTONS, const E: usize = MAX_ENCODERS> {
    pub button_active: [bool; B],
    pub cycle_index: [u8; B],
    pub encoder_values: [u8; E],
}
Expand description

Runtime state for a single preset (not persisted across power cycles).

Fields§

§button_active: [bool; B]§cycle_index: [u8; B]§encoder_values: [u8; E]

Implementations§

Source§

impl<const B: usize, const E: usize> PresetState<B, E>

Source

pub fn from_defaults<const A: usize>(preset: &Preset<B, E, A>) -> Self

Create a PresetState from a preset’s declared defaults.

Source§

impl<const B: usize, const E: usize> PresetState<B, E>

Source

pub const SIZE: usize

Serialized byte size for this configuration.

Source

pub fn to_bytes(&self, buf: &mut [u8])

Serialize to a fixed-size buffer.

Source

pub fn from_bytes(buf: &[u8]) -> Self

Deserialize from a byte buffer.

Trait Implementations§

Source§

impl<const B: usize, const E: usize> Clone for PresetState<B, E>

Source§

fn clone(&self) -> PresetState<B, E>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const B: usize, const E: usize> Debug for PresetState<B, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const B: usize, const E: usize> Default for PresetState<B, E>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const B: usize, const E: usize> Eq for PresetState<B, E>

Source§

impl<const B: usize, const E: usize> PartialEq for PresetState<B, E>

Source§

fn eq(&self, other: &PresetState<B, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const B: usize, const E: usize> StructuralPartialEq for PresetState<B, E>

Auto Trait Implementations§

§

impl<const B: usize, const E: usize> Freeze for PresetState<B, E>

§

impl<const B: usize, const E: usize> RefUnwindSafe for PresetState<B, E>

§

impl<const B: usize, const E: usize> Send for PresetState<B, E>

§

impl<const B: usize, const E: usize> Sync for PresetState<B, E>

§

impl<const B: usize, const E: usize> Unpin for PresetState<B, E>

§

impl<const B: usize, const E: usize> UnsafeUnpin for PresetState<B, E>

§

impl<const B: usize, const E: usize> UnwindSafe for PresetState<B, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.