pub struct Encoder<T> { /* private fields */ }Expand description
Encodes JSON records into frame payloads.
The track-free core of Producer. Unlike
snapshot::Encoder there are no group boundaries to report: a log is
an unbroken sequence of self-contained records, so every payload is simply the next frame.
Payloads must reach the wire in order. A group has no size cap, so the encoder keeps no budget.
Implementations§
Source§impl<T: Serialize> Encoder<T>
impl<T: Serialize> Encoder<T>
Sourcepub fn encode(&mut self, value: &T) -> Result<Pending<'_, T>>
pub fn encode(&mut self, value: &T) -> Result<Pending<'_, T>>
Encode one record into the next frame payload.
The record comes back as a Pending the caller writes and then
commits.
Errors with [moq_net::Error::FrameTooLarge] if the record is larger than one frame may be
(32 MiB, what moq-net’s group cache holds), and with crate::Error::Json if it nests too
deeply for a decoder to read. The refused record leaves the encoder untouched.
Auto Trait Implementations§
impl<T> Freeze for Encoder<T>
impl<T> RefUnwindSafe for Encoder<T>
impl<T> Send for Encoder<T>
impl<T> Sync for Encoder<T>
impl<T> Unpin for Encoder<T>
impl<T> UnsafeUnpin for Encoder<T>
impl<T> UnwindSafe for Encoder<T>
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