Skip to main content

Bus

Struct Bus 

Source
pub struct Bus { /* private fields */ }
Expand description

One CAN interface plus the vendor codec attached to it.

One Bus instance per physical interface; the codec is shared across every group attached to the bus, so inbound frames are decoded exactly once per frame.

Implementations§

Source§

impl Bus

Source

pub fn new(transport: Box<dyn CanBus>, codec: Box<dyn MotorCodec>) -> Self

Construct a bus and invoke codec.bind_to_bus(transport.capabilities()) exactly once.

Source

pub fn vendor(&self) -> &str

Vendor short-name of the attached codec.

Source

pub fn capabilities(&self) -> BusCapabilities

Capabilities reported by the underlying transport.

Source

pub fn codec_supports(&self, mt: MotorTypeId) -> bool

True iff the bus’s codec can encode/decode this motor type.

Source

pub fn routes(&self) -> &HashMap<u32, RouteKey>

Read-only access to the per-bus recv-id routing table (populated by Robot::connect).

Auto Trait Implementations§

§

impl Freeze for Bus

§

impl !RefUnwindSafe for Bus

§

impl Send for Bus

§

impl !Sync for Bus

§

impl Unpin for Bus

§

impl UnsafeUnpin for Bus

§

impl !UnwindSafe for Bus

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.