pub struct TcpFrame {
prefix: [u8; 2],
payload: Vec<u8>,
}Fields§
§prefix: [u8; 2]§payload: Vec<u8>Implementations§
Source§impl TcpFrame
impl TcpFrame
Sourcepub fn try_new(payload: Vec<u8>) -> Result<Self, FrameTooLargeError>
pub fn try_new(payload: Vec<u8>) -> Result<Self, FrameTooLargeError>
Frames payload with its RFC 4571 length prefix.
§Errors
Returns FrameTooLargeError when the payload doesn’t fit in the 2 bytes length
header.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Whether this frame is NULL according to RFC 4571 (i.e. prefix length of 0).
pub fn io_slices(&self) -> [IoSlice<'_>; 2]
pub fn into_payload(self) -> Vec<u8> ⓘ
pub fn payload(&self) -> &[u8] ⓘ
Trait Implementations§
impl StructuralPartialEq for TcpFrame
Auto Trait Implementations§
impl Freeze for TcpFrame
impl RefUnwindSafe for TcpFrame
impl Send for TcpFrame
impl Sync for TcpFrame
impl Unpin for TcpFrame
impl UnsafeUnpin for TcpFrame
impl UnwindSafe for TcpFrame
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