Struct StatusPacket

Source
pub struct StatusPacket<'a> { /* private fields */ }
Expand description

A status response that is currently in the read buffer of a bus.

When dropped, the response data is removed from the read buffer.

Implementations§

Source§

impl<'a> StatusPacket<'a>

Source

pub fn as_bytes(&self) -> &[u8]

Get the raw bytes of the message.

This includes the message header and the parameters. It does not include the CRC or byte-stuffing.

Source

pub fn packet_id(&self) -> u8

The packet ID of the response.

Source

pub fn instruction_id(&self) -> u8

The instruction ID of the response.

Source

pub fn error(&self) -> u8

The error field of the response.

Source

pub fn error_number(&self) -> u8

The error number of the status packet.

This is the lower 7 bits of the error field.

Source

pub fn alert(&self) -> bool

The alert bit from the error field of the response.

This is the 8th bit of the error field.

If this bit is set, you can normally check the “Hardware Error” register for more details. Consult the manual of your motor for more information.

Source

pub fn parameters(&self) -> &[u8]

The parameters of the response.

Trait Implementations§

Source§

impl<'a> Debug for StatusPacket<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a, 'b> From<&'b StatusPacket<'a>> for Response<&'b [u8]>

Source§

fn from(status_packet: &'b StatusPacket<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<StatusPacket<'a>> for Response<Vec<u8>>

Source§

fn from(status_packet: StatusPacket<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> TryFrom<StatusPacket<'a>> for Response<()>

Source§

type Error = InvalidParameterCount

The type returned in the event of a conversion error.
Source§

fn try_from(status_packet: StatusPacket<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<StatusPacket<'a>> for Response<Ping>

Source§

type Error = InvalidParameterCount

The type returned in the event of a conversion error.
Source§

fn try_from(status_packet: StatusPacket<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<StatusPacket<'a>> for Response<u16>

Source§

type Error = InvalidParameterCount

The type returned in the event of a conversion error.
Source§

fn try_from(status_packet: StatusPacket<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<StatusPacket<'a>> for Response<u32>

Source§

type Error = InvalidParameterCount

The type returned in the event of a conversion error.
Source§

fn try_from(status_packet: StatusPacket<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<StatusPacket<'a>> for Response<u8>

Source§

type Error = InvalidParameterCount

The type returned in the event of a conversion error.
Source§

fn try_from(status_packet: StatusPacket<'a>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for StatusPacket<'a>

§

impl<'a> RefUnwindSafe for StatusPacket<'a>

§

impl<'a> Send for StatusPacket<'a>

§

impl<'a> Sync for StatusPacket<'a>

§

impl<'a> Unpin for StatusPacket<'a>

§

impl<'a> UnwindSafe for StatusPacket<'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.