pub struct CompState { /* private fields */ }Expand description
Per-channel delta + adaptive Rice state for comp/1.
On TCP, the outlet and inlet each hold one CompState that stays in
lockstep across compressed (0xF9/0xFA) and plain fallback (0x01/0x02)
samples.
Implementations§
Source§impl CompState
impl CompState
Sourcepub fn new(format: Format, channels: usize) -> Self
pub fn new(format: Format, channels: usize) -> Self
Create a fresh compression state for a numeric stream.
Sourcepub fn supports(format: Format) -> bool
pub fn supports(format: Format) -> bool
True when format supports comp/1 (any fixed-width numeric format).
Sourcepub fn encode_tcp_sample(
&mut self,
codec: &Codec,
sample: &PackedSample,
timestamp: f64,
out: &mut Vec<u8>,
) -> Result<(), Error>
pub fn encode_tcp_sample( &mut self, codec: &Codec, sample: &PackedSample, timestamp: f64, out: &mut Vec<u8>, ) -> Result<(), Error>
Encode one sample onto a TCP buffer, automatically falling back to a
plain LSL sample (0x01/0x02) when compression does not save bytes.
Sourcepub fn decode_tcp_sample(
&mut self,
codec: &Codec,
buf: &[u8],
) -> Result<(PackedSample, usize, usize), Error>
pub fn decode_tcp_sample( &mut self, codec: &Codec, buf: &[u8], ) -> Result<(PackedSample, usize, usize), Error>
Decode one TCP sample (0xF9, 0xFA, or plain 0x01/0x02 fallback).
Returns the decoded PackedSample, total wire bytes consumed, and the
uncompressed payload size (for compression ratio accounting).
Trait Implementations§
Auto Trait Implementations§
impl Forget for CompState
impl Freeze for CompState
impl Move for CompState
impl RefUnwindSafe for CompState
impl Send for CompState
impl Sync for CompState
impl Unpin for CompState
impl UnsafeUnpin for CompState
impl UnwindSafe for CompState
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