pub struct CodeMap { /* private fields */ }Expand description
A checked conversion of one component from one SampleEncoding to another.
Construction selects the rule once from the role, signal range, and both encodings; mapping performs integer arithmetic only and never allocates.
Implementations§
Source§impl CodeMap
impl CodeMap
Sourcepub const fn new(
from: SampleEncoding,
to: SampleEncoding,
role: CodeRole,
range: SignalRange,
) -> Result<Self, CodeMapError>
pub const fn new( from: SampleEncoding, to: SampleEncoding, role: CodeRole, range: SignalRange, ) -> Result<Self, CodeMapError>
Prepare the conversion of role codes from from to to.
Sourcepub const fn input(&self) -> SampleEncoding
pub const fn input(&self) -> SampleEncoding
Encoding of the words this map reads.
Sourcepub const fn output(&self) -> SampleEncoding
pub const fn output(&self) -> SampleEncoding
Encoding of the words this map writes.
Sourcepub const fn map_code(&self, code: u16) -> u16
pub const fn map_code(&self, code: u16) -> u16
Convert one source code (bits above its depth are ignored) to a destination code.
Trait Implementations§
impl Copy for CodeMap
impl Eq for CodeMap
impl StructuralPartialEq for CodeMap
Auto Trait Implementations§
impl Freeze for CodeMap
impl RefUnwindSafe for CodeMap
impl Send for CodeMap
impl Sync for CodeMap
impl Unpin for CodeMap
impl UnsafeUnpin for CodeMap
impl UnwindSafe for CodeMap
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