pub struct FrameWriter { /* private fields */ }Expand description
Writes length-prefixed frames to a byte buffer.
Implementations§
Source§impl FrameWriter
impl FrameWriter
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new frame writer with the specified initial capacity.
Sourcepub fn write_frame(&mut self, payload: &[u8]) -> Result<(), ControlError>
pub fn write_frame(&mut self, payload: &[u8]) -> Result<(), ControlError>
Writes a frame with the given payload.
§Errors
Returns an error if the payload exceeds MAX_FRAME_SIZE.
Sourcepub fn take_bytes(&mut self) -> Vec<u8> ⓘ
pub fn take_bytes(&mut self) -> Vec<u8> ⓘ
Takes the accumulated bytes from the buffer.
This clears the internal buffer and returns the data.
Trait Implementations§
Source§impl Debug for FrameWriter
impl Debug for FrameWriter
Source§impl Default for FrameWriter
impl Default for FrameWriter
Source§fn default() -> FrameWriter
fn default() -> FrameWriter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FrameWriter
impl RefUnwindSafe for FrameWriter
impl Send for FrameWriter
impl Sync for FrameWriter
impl Unpin for FrameWriter
impl UnwindSafe for FrameWriter
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