pub struct StreamingFrame {
pub frame_type: FrameType,
pub flags: FrameFlags,
pub chunk_size: usize,
pub checksum: u32,
pub payload: Vec<u8>,
}Expand description
Streaming frame structure
Frame layout:
┌──────────┬──────────┬──────────────┬──────────┬─────────────┐
│ FRAME_ID │ FLAGS │ CHUNK_SIZE │ CHECKSUM │ PAYLOAD │
│ (1 byte) │ (1 byte) │ (VarInt) │ (4 bytes)│ (variable) │
└──────────┴──────────┴──────────────┴──────────┴─────────────┘Fields§
§frame_type: FrameTypeFrame type identifier
flags: FrameFlagsFrame flags
chunk_size: usizeSize of the payload chunk (0 for BEGIN/END/ERROR frames)
checksum: u32XOR checksum of the payload (0 for BEGIN/END frames)
payload: Vec<u8>Frame payload data
Implementations§
Source§impl StreamingFrame
impl StreamingFrame
Sourcepub fn compute_xor_checksum(data: &[u8]) -> u32
pub fn compute_xor_checksum(data: &[u8]) -> u32
Computes XOR checksum for payload data
Sourcepub fn validate_checksum(&self) -> Result<(), StreamingError>
pub fn validate_checksum(&self) -> Result<(), StreamingError>
Validates the checksum of this frame
Trait Implementations§
Source§impl Clone for StreamingFrame
impl Clone for StreamingFrame
Source§fn clone(&self) -> StreamingFrame
fn clone(&self) -> StreamingFrame
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StreamingFrame
impl Debug for StreamingFrame
Source§impl PartialEq for StreamingFrame
impl PartialEq for StreamingFrame
impl StructuralPartialEq for StreamingFrame
Auto Trait Implementations§
impl Freeze for StreamingFrame
impl RefUnwindSafe for StreamingFrame
impl Send for StreamingFrame
impl Sync for StreamingFrame
impl Unpin for StreamingFrame
impl UnwindSafe for StreamingFrame
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