pub struct Producer { /* private fields */ }Expand description
Exclusive writer for one group; frames are numbered from 0 in write order.
Dropping without Self::finish or Self::abort lets the net group close uncleanly.
Implementations§
Source§impl Producer
impl Producer
Sourcepub fn next_frame(&self) -> u32
pub fn next_frame(&self) -> u32
Next frame index that will be written.
Sourcepub fn write_frame(
&mut self,
timestamp: Timestamp,
plaintext: &[u8],
) -> Result<()>
pub fn write_frame( &mut self, timestamp: Timestamp, plaintext: &[u8], ) -> Result<()>
Encrypt plaintext at the next frame index and write the ciphertext.
The identity is spent before the net write, so a failed write never repeats a nonce with different bytes. Predictable failures, an oversize plaintext or a timestamp the track cannot represent, are refused before encryption.
§Errors
Error::Identity if the next frame exceeds 32 bits, Error::Exhausted,
Error::Oversize, or a net write error.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Producer
impl RefUnwindSafe for Producer
impl Send for Producer
impl Sync for Producer
impl Unpin for Producer
impl UnsafeUnpin for Producer
impl UnwindSafe for Producer
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