pub struct Payload { /* private fields */ }Expand description
Raw payload data with escape handling
Implementations§
Source§impl Payload
impl Payload
Sourcepub fn from_string(s: &str) -> Self
pub fn from_string(s: &str) -> Self
Create from string slice
Sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Create from bytes
Sourcepub fn push_u16_le(&mut self, v: u16)
pub fn push_u16_le(&mut self, v: u16)
Push a u16 as little-endian
Sourcepub fn push_u32_le(&mut self, v: u32)
pub fn push_u32_le(&mut self, v: u32)
Push a u32 as little-endian
Sourcepub fn decode(data: &[u8]) -> ProtocolResult<Self>
pub fn decode(data: &[u8]) -> ProtocolResult<Self>
Decode payload from wire format (with escape sequences)
Sourcepub fn read_u16_le(&self, offset: usize) -> Option<u16>
pub fn read_u16_le(&self, offset: usize) -> Option<u16>
Read a u16 LE at offset
Sourcepub fn read_u32_le(&self, offset: usize) -> Option<u32>
pub fn read_u32_le(&self, offset: usize) -> Option<u32>
Read a u32 LE at offset
Trait Implementations§
impl Eq for Payload
impl StructuralPartialEq for Payload
Auto Trait Implementations§
impl Freeze for Payload
impl RefUnwindSafe for Payload
impl Send for Payload
impl Sync for Payload
impl Unpin for Payload
impl UnsafeUnpin for Payload
impl UnwindSafe for Payload
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