pub struct Encoder<const SENTINEL: u8 = DEFAULT_SENTINEL, const MAX_LEN: usize = DEFAULT_MAX_LEN>;Expand description
Frame encoder.
This type implements Encoder<impl AsRef<[i8]>>;
it encodes any message type that be converted to a byte slice
using AsRef<[u8]>.
This type can be customized via generic parameters:
SENTINEL: Choose a byte to be used as a frame separator.
The corresponding Decoder must use the same value.
Refer to the crate documentation for more details on choosing a sentinel.
MAX_LEN: Choose the maximum size of a message,
or set to 0 for unlimited message sizes.
This parameter is used as an optimization.
If any message exceeds this limit, encoding will panic.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<const SENTINEL: u8, const MAX_LEN: usize> Freeze for Encoder<SENTINEL, MAX_LEN>
impl<const SENTINEL: u8, const MAX_LEN: usize> RefUnwindSafe for Encoder<SENTINEL, MAX_LEN>
impl<const SENTINEL: u8, const MAX_LEN: usize> Send for Encoder<SENTINEL, MAX_LEN>
impl<const SENTINEL: u8, const MAX_LEN: usize> Sync for Encoder<SENTINEL, MAX_LEN>
impl<const SENTINEL: u8, const MAX_LEN: usize> Unpin for Encoder<SENTINEL, MAX_LEN>
impl<const SENTINEL: u8, const MAX_LEN: usize> UnwindSafe for Encoder<SENTINEL, MAX_LEN>
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