pub struct CanTransmitter<C, D> { /* private fields */ }
Expand description

Splits outgoing transfers into frames

Implementations§

source§

impl<C, D> CanTransmitter<C, D>where C: Clock, D: TransmitDriver<C>,

source

pub fn new(mtu: Mtu) -> Self

Creates a transmitter

mtu: The maximum number of bytes in a frame

source

pub fn set_mtu(&mut self, mtu: Mtu)

Sets the MTU

This will take effect on the next call to push().

source

pub fn transfer_count(&self) -> u64

Returns the number of transfers successfully transmitted

Success means that the frames were placed into the frame queue successfully. CAN bus errors are ignored.

source

pub fn error_count(&self) -> u64

Returns the number of transfers that could not be transmitted

A failure to allocate memory is considered an error. CAN bus errors are ignored.

Trait Implementations§

source§

impl<C, D> Transmitter<C> for CanTransmitter<C, D>where C: Clock, D: TransmitDriver<C>,

source§

fn push<A>( &mut self, transfer: Transfer<A, C::Instant, CanTransport>, clock: &mut C, driver: &mut D ) -> Result<(), Self::Error>where A: AsRef<[u8]>,

Breaks a transfer into frames

The frames can be retrieved and sent using the peek() and pop() functions.

This function returns an error if the queue does not have enough space to hold all the required frames.

§

type Transport = CanTransport

The transport that this transmitter works with
§

type Driver = D

The driver type that this transmitter uses to send frames
§

type Error = Error<<D as TransmitDriver<C>>::Error>

An error type Read more
source§

fn flush(&mut self, clock: &mut C, driver: &mut D) -> Result<(), Self::Error>

Attempts to send all queued outgoing frames Read more
source§

fn mtu(&self) -> usize

Returns the maximum transmission unit of this transport, in bytes Read more

Auto Trait Implementations§

§

impl<C, D> RefUnwindSafe for CanTransmitter<C, D>where C: RefUnwindSafe, D: RefUnwindSafe,

§

impl<C, D> Send for CanTransmitter<C, D>where C: Send, D: Send,

§

impl<C, D> Sync for CanTransmitter<C, D>where C: Sync, D: Sync,

§

impl<C, D> Unpin for CanTransmitter<C, D>where C: Unpin, D: Unpin,

§

impl<C, D> UnwindSafe for CanTransmitter<C, D>where C: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.