AUDIO
Source snapshot · 12 October 2026

API reference / ravet_foundation::ParameterState

Struct ParameterState 

pub struct ParameterState<'a, const N: usize> { /* private fields */ }
Expand description

Complete validated physical values tied to their schema. No DSP history.

Implementations§

§

impl<'a, const N: usize> ParameterState<'a, N>

pub fn values(&self) -> &[f32; N]

pub fn get(&self, id: ParameterId) -> Option<f32>

pub fn set(&mut self, id: ParameterId, value: f32) -> Result<(), ParameterError>

Validate before mutation; failure leaves the complete state unchanged.

pub fn migrate<'b, const M: usize>( &self, target: ParameterSchema<'b, M>, ) -> Result<ParameterState<'b, M>, ParameterError>

Migrate by stable ID: new fields use defaults, removed fields are dropped. Changed ranges must still accept the old physical value; no silent clamp. Products must explicitly select an allowed source version before migration.

pub fn encoded_len() -> Option<usize>

Record size: 8-byte product ID, u32 version, u32 count, then ID/f32 pairs.

pub fn encode( &self, product: [u8; 8], version: u32, output: &mut [u8], ) -> Result<(), ParameterError>

Write an exact-length little-endian record. Version zero is reserved. Invalid destination/version leaves the destination unchanged.

pub fn decode( schema: ParameterSchema<'a, N>, product: [u8; 8], version: u32, input: &[u8], ) -> Result<Self, ParameterError>

Decode a complete record in any field order. Reject missing, duplicate, unknown IDs, trailing bytes, invalid values and unexpected versions. No live state is mutated; publish only the returned complete result.

Trait Implementations§

§

impl<'a, const N: usize> Clone for ParameterState<'a, N>

§

fn clone(&self) -> ParameterState<'a, N>

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

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

Performs copy-assignment from source. Read more
§

impl<'a, const N: usize> Copy for ParameterState<'a, N>

§

impl<'a, const N: usize> Debug for ParameterState<'a, N>

§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, const N: usize> Freeze for ParameterState<'a, N>

§

impl<'a, const N: usize> RefUnwindSafe for ParameterState<'a, N>

§

impl<'a, const N: usize> Send for ParameterState<'a, N>

§

impl<'a, const N: usize> Sync for ParameterState<'a, N>

§

impl<'a, const N: usize> Unpin for ParameterState<'a, N>

§

impl<'a, const N: usize> UnsafeUnpin for ParameterState<'a, N>

§

impl<'a, const N: usize> UnwindSafe for ParameterState<'a, N>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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

Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.