pub struct WriteCombiner<'a> { /* private fields */ }Expand description
Combines consecutive register writes of the same resolution for efficiency.
This helper determines how to group registers when encoding them to minimize the required bytes in the frame. It tracks state and writes framing bytes when the resolution changes.
Implementations§
Source§impl<'a> WriteCombiner<'a>
impl<'a> WriteCombiner<'a>
Sourcepub fn new(
base_command: u8,
start_register: u16,
resolutions: &'a [Resolution],
) -> Self
pub fn new( base_command: u8, start_register: u16, resolutions: &'a [Resolution], ) -> Self
Creates a new WriteCombiner.
§Arguments
base_command- Base command (0x00 for write, 0x10 for read)start_register- First register address in the sequenceresolutions- Resolution for each register in sequence
Sourcepub fn reply_size(&self) -> u8
pub fn reply_size(&self) -> u8
Returns the expected reply size so far.
Sourcepub fn maybe_write(&mut self, frame: &mut WriteCanData<'_>) -> bool
pub fn maybe_write(&mut self, frame: &mut WriteCanData<'_>) -> bool
Advances to the next register and writes framing if needed.
Returns true if the caller should write the register value.
Returns false if the register should be skipped (Ignore resolution).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for WriteCombiner<'a>
impl<'a> RefUnwindSafe for WriteCombiner<'a>
impl<'a> Send for WriteCombiner<'a>
impl<'a> Sync for WriteCombiner<'a>
impl<'a> Unpin for WriteCombiner<'a>
impl<'a> UnsafeUnpin for WriteCombiner<'a>
impl<'a> UnwindSafe for WriteCombiner<'a>
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