pub struct Message {
pub header: Header,
pub data: Option<Data>,
}Expand description
A USB PD message.
Fields§
§header: HeaderThe message header.
data: Option<Data>Optional payload data (for data messages).
Implementations§
Source§impl Message
impl Message
Sourcepub fn to_bytes(&self, buffer: &mut [u8]) -> usize
pub fn to_bytes(&self, buffer: &mut [u8]) -> usize
Serialize a message to a slice, returning the number of written bytes.
Sourcepub fn from_bytes_with_state<P: PdoState>(data: &[u8], state: &P) -> Self
pub fn from_bytes_with_state<P: PdoState>(data: &[u8], state: &P) -> Self
Parse a message from a slice of bytes, with a PDO state.
FIXME: Is the state required/to spec?
Sourcepub fn from_bytes(data: &[u8]) -> Self
pub fn from_bytes(data: &[u8]) -> Self
Parse a message from a slice of bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> UnsafeFrom<U> for Twhere
U: Into<T>,
impl<T, U> UnsafeFrom<U> for Twhere
U: Into<T>,
Source§unsafe fn unsafe_from(other: U) -> T
unsafe fn unsafe_from(other: U) -> T
Calls U::into(other).
That is, this conversion is whatever the implementation of Into<T> for U chooses to
do.
Source§impl<T, U> UnsafeInto<U> for Twhere
U: UnsafeFrom<T>,
impl<T, U> UnsafeInto<U> for Twhere
U: UnsafeFrom<T>,
Source§unsafe fn unsafe_into(self) -> U
unsafe fn unsafe_into(self) -> U
Calls U::unsafe_from(self).
That is, this conversion is whatever the implementation of UnsafeFrom<T> for U
chooses to do.