Struct Parameter State
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>
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>
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>
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>
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>
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>
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>
impl<'a, const N: usize> Clone for ParameterState<'a, N>
§fn clone(&self) -> ParameterState<'a, N>
fn clone(&self) -> ParameterState<'a, N>
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more