Skip to main content

WriteCombiner

Struct WriteCombiner 

Source
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>

Source

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 sequence
  • resolutions - Resolution for each register in sequence
Source

pub fn reply_size(&self) -> u8

Returns the expected reply size so far.

Source

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§

Source§

impl<'a> Debug for WriteCombiner<'a>

Source§

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

Formats the value using the given formatter. Read more

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> 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> 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.