Struct stun_codec::MessageEncoder
source · [−]pub struct MessageEncoder<A: Attribute> { /* private fields */ }
Expand description
Message
encoder.
Implementations
sourceimpl<A: Attribute> MessageEncoder<A>
impl<A: Attribute> MessageEncoder<A>
Trait Implementations
sourceimpl<A: Debug + Attribute> Debug for MessageEncoder<A>
impl<A: Debug + Attribute> Debug for MessageEncoder<A>
sourceimpl<A: Attribute> Default for MessageEncoder<A>
impl<A: Attribute> Default for MessageEncoder<A>
sourceimpl<A: Attribute> Encode for MessageEncoder<A>
impl<A: Attribute> Encode for MessageEncoder<A>
sourcefn encode(&mut self, buf: &mut [u8], eos: Eos) -> Result<usize>
fn encode(&mut self, buf: &mut [u8], eos: Eos) -> Result<usize>
Encodes the items in the encoder and writes the encoded bytes to the given buffer. Read more
sourcefn start_encoding(&mut self, item: Self::Item) -> Result<()>
fn start_encoding(&mut self, item: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
sourcefn requiring_bytes(&self) -> ByteCount
fn requiring_bytes(&self) -> ByteCount
Returns the number of bytes required to encode all the items in the encoder. Read more
sourceimpl<A: Attribute> SizedEncode for MessageEncoder<A>
impl<A: Attribute> SizedEncode for MessageEncoder<A>
sourcefn exact_requiring_bytes(&self) -> u64
fn exact_requiring_bytes(&self) -> u64
Returns the exact number of bytes required to encode all the items remaining in the encoder.
Auto Trait Implementations
impl<A> RefUnwindSafe for MessageEncoder<A> where
A: RefUnwindSafe,
<A as Attribute>::Encoder: RefUnwindSafe,
impl<A> Send for MessageEncoder<A> where
A: Send,
<A as Attribute>::Encoder: Send,
impl<A> Sync for MessageEncoder<A> where
A: Sync,
<A as Attribute>::Encoder: Sync,
impl<A> Unpin for MessageEncoder<A> where
A: Unpin,
<A as Attribute>::Encoder: Unpin,
impl<A> UnwindSafe for MessageEncoder<A> where
A: UnwindSafe + RefUnwindSafe,
<A as Attribute>::Encoder: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> EncodeExt for T where
T: Encode,
impl<T> EncodeExt for T where
T: Encode,
sourcefn with_item(item: Self::Item) -> Result<Self, Error> where
Self: Default,
fn with_item(item: Self::Item) -> Result<Self, Error> where
Self: Default,
Creates a new encoder instance that has the given initial item. Read more
sourcefn map_err<E, F>(self, f: F) -> MapErr<Self, E, F> where
F: Fn(Error) -> E,
Error: From<E>,
fn map_err<E, F>(self, f: F) -> MapErr<Self, E, F> where
F: Fn(Error) -> E,
Error: From<E>,
Creates an encoder for modifying encoding errors produced by self
. Read more
sourcefn map_from<T, F>(self, f: F) -> MapFrom<Self, T, F> where
F: Fn(T) -> Self::Item,
fn map_from<T, F>(self, f: F) -> MapFrom<Self, T, F> where
F: Fn(T) -> Self::Item,
Creates an encoder that converts items into ones that
suited to the self
encoder by calling the given function. Read more
sourcefn try_map_from<T, E, F>(self, f: F) -> TryMapFrom<Self, T, E, F> where
F: Fn(T) -> Result<Self::Item, E>,
Error: From<E>,
fn try_map_from<T, E, F>(self, f: F) -> TryMapFrom<Self, T, E, F> where
F: Fn(T) -> Result<Self::Item, E>,
Error: From<E>,
Creates an encoder that tries to convert items into ones that
suited to the self
encoder by calling the given function. Read more
sourcefn optional(self) -> Optional<Self>
fn optional(self) -> Optional<Self>
Creates an encoder that represents an optional encoder. Read more
sourcefn max_bytes(self, n: u64) -> MaxBytes<Self>
fn max_bytes(self, n: u64) -> MaxBytes<Self>
Creates an encoder that will fail if the number of encoded bytes of an item exceeds n
. Read more
sourcefn length(self, n: u64) -> Length<Self>
fn length(self, n: u64) -> Length<Self>
Creates an encoder that required to encode each item exactly at the specified number of bytes. Read more
sourcefn chain<T>(self, other: T) -> TupleEncoder<(Self, T)> where
T: Encode,
fn chain<T>(self, other: T) -> TupleEncoder<(Self, T)> where
T: Encode,
Takes two encoders and creates a new encoder that encodes both items in sequence. Read more
sourcefn repeat<I>(self) -> Repeat<Self, I> where
I: Iterator<Item = Self::Item>,
fn repeat<I>(self) -> Repeat<Self, I> where
I: Iterator<Item = Self::Item>,
Creates an encoder that repeats encoding of Self::Item
. Read more
sourcefn pre_encode(self) -> PreEncode<Self>
fn pre_encode(self) -> PreEncode<Self>
Creates an encoder that pre-encodes items when start_encoding
method is called. Read more
sourcefn slice(self) -> Slice<Self>
fn slice(self) -> Slice<Self>
Creates an encoder that makes it possible to slice the encoded byte sequence in arbitrary units. Read more