pub struct FrameWriter { /* private fields */ }Expand description
Writes length-prefixed frames to a byte stream.
Each frame is: [LEB128 length][payload bytes] This enables streaming — you can send frames one at a time over a TCP connection, WebSocket, etc.
§Example
use vexil_runtime::{BitWriter, FrameWriter};
let mut fw = FrameWriter::new();
// Encode first message
let mut w = BitWriter::new();
w.write_u32(42);
let bytes = w.finish();
fw.write_frame(&bytes);
// Encode second message
let mut w = BitWriter::new();
w.write_string("hello");
let bytes = w.finish();
fw.write_frame(&bytes);
let stream = fw.finish();
// stream = [1, 42, 0, 0, 0, 6, h, e, l, l, o]
// ^len=1 ^payload ^len=6 ^payloadImplementations§
Source§impl FrameWriter
impl FrameWriter
Sourcepub fn write_frame(&mut self, payload: &[u8])
pub fn write_frame(&mut self, payload: &[u8])
Write a single frame. The payload is typically the output
of BitWriter::finish().
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FrameWriter
impl RefUnwindSafe for FrameWriter
impl Send for FrameWriter
impl Sync for FrameWriter
impl Unpin for FrameWriter
impl UnsafeUnpin 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