Struct sermux_proto::OwnedPortChunk
source · pub struct OwnedPortChunk {
pub port: u16,
pub chunk: Vec<u8>,
}
Expand description
Like PortChunk, but owns the storage instead
Only available with the use-std
feature active
Fields§
§port: u16
§chunk: Vec<u8>
Implementations§
source§impl OwnedPortChunk
impl OwnedPortChunk
sourcepub fn new(port: u16, chunk: Vec<u8>) -> Self
pub fn new(port: u16, chunk: Vec<u8>) -> Self
Create a new OwnedPortChunk from the given port and data
sourcepub fn buffer_required(&self) -> usize
pub fn buffer_required(&self) -> usize
Calculate the size required to encode the given data payload size
sourcepub fn encode_to<'b>(
&self,
out_buf: &'b mut [u8],
) -> Result<&'b mut [u8], EncodeError>
pub fn encode_to<'b>( &self, out_buf: &'b mut [u8], ) -> Result<&'b mut [u8], EncodeError>
Encodes the current PortChunk into the given buffer
sourcepub fn decode(data: &[u8]) -> Result<Self, DecodeError>
pub fn decode(data: &[u8]) -> Result<Self, DecodeError>
Decodes an OwnedPortChunk from the given buffer
Unlike PortChunk::decode_from, this will not mutate the given buffer.
sourcepub fn as_port_chunk(&self) -> PortChunk<'_>
pub fn as_port_chunk(&self) -> PortChunk<'_>
Borrows self as a PortChunk
Auto Trait Implementations§
impl Freeze for OwnedPortChunk
impl RefUnwindSafe for OwnedPortChunk
impl Send for OwnedPortChunk
impl Sync for OwnedPortChunk
impl Unpin for OwnedPortChunk
impl UnwindSafe for OwnedPortChunk
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