pub struct TupleEncoder<E> { /* private fields */ }
Expand description
Encoder for tuples.
Implementations§
Source§impl<E> TupleEncoder<E>
impl<E> TupleEncoder<E>
Sourcepub fn into_inner(self) -> E
pub fn into_inner(self) -> E
Takes ownership of this instance and returns the inner encoders.
Trait Implementations§
Source§impl<E: Debug> Debug for TupleEncoder<E>
impl<E: Debug> Debug for TupleEncoder<E>
Source§impl<E: Default> Default for TupleEncoder<E>
impl<E: Default> Default for TupleEncoder<E>
Source§fn default() -> TupleEncoder<E>
fn default() -> TupleEncoder<E>
Returns the “default value” for a type. Read more
Source§impl<E0, E1> Encode for TupleEncoder<(E0, E1)>
impl<E0, E1> Encode for TupleEncoder<(E0, E1)>
Source§fn 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
Source§fn start_encoding(&mut self, t: Self::Item) -> Result<()>
fn start_encoding(&mut self, t: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
Source§fn 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
Source§impl<E0, E1, E2> Encode for TupleEncoder<(E0, E1, E2)>
impl<E0, E1, E2> Encode for TupleEncoder<(E0, E1, E2)>
Source§type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item)
type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item)
The type of items to be encoded.
Source§fn 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
Source§fn start_encoding(&mut self, t: Self::Item) -> Result<()>
fn start_encoding(&mut self, t: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
Source§fn 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
Source§impl<E0, E1, E2, E3> Encode for TupleEncoder<(E0, E1, E2, E3)>
impl<E0, E1, E2, E3> Encode for TupleEncoder<(E0, E1, E2, E3)>
Source§type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item)
type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item)
The type of items to be encoded.
Source§fn 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
Source§fn start_encoding(&mut self, t: Self::Item) -> Result<()>
fn start_encoding(&mut self, t: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
Source§fn 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
Source§impl<E0, E1, E2, E3, E4> Encode for TupleEncoder<(E0, E1, E2, E3, E4)>
impl<E0, E1, E2, E3, E4> Encode for TupleEncoder<(E0, E1, E2, E3, E4)>
Source§type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item, <E4 as Encode>::Item)
type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item, <E4 as Encode>::Item)
The type of items to be encoded.
Source§fn 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
Source§fn start_encoding(&mut self, t: Self::Item) -> Result<()>
fn start_encoding(&mut self, t: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
Source§fn 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
Source§impl<E0, E1, E2, E3, E4, E5> Encode for TupleEncoder<(E0, E1, E2, E3, E4, E5)>
impl<E0, E1, E2, E3, E4, E5> Encode for TupleEncoder<(E0, E1, E2, E3, E4, E5)>
Source§type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item, <E4 as Encode>::Item, <E5 as Encode>::Item)
type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item, <E4 as Encode>::Item, <E5 as Encode>::Item)
The type of items to be encoded.
Source§fn 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
Source§fn start_encoding(&mut self, t: Self::Item) -> Result<()>
fn start_encoding(&mut self, t: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
Source§fn 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
Source§impl<E0, E1, E2, E3, E4, E5, E6> Encode for TupleEncoder<(E0, E1, E2, E3, E4, E5, E6)>
impl<E0, E1, E2, E3, E4, E5, E6> Encode for TupleEncoder<(E0, E1, E2, E3, E4, E5, E6)>
Source§type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item, <E4 as Encode>::Item, <E5 as Encode>::Item, <E6 as Encode>::Item)
type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item, <E4 as Encode>::Item, <E5 as Encode>::Item, <E6 as Encode>::Item)
The type of items to be encoded.
Source§fn 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
Source§fn start_encoding(&mut self, t: Self::Item) -> Result<()>
fn start_encoding(&mut self, t: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
Source§fn 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
Source§impl<E0, E1, E2, E3, E4, E5, E6, E7> Encode for TupleEncoder<(E0, E1, E2, E3, E4, E5, E6, E7)>
impl<E0, E1, E2, E3, E4, E5, E6, E7> Encode for TupleEncoder<(E0, E1, E2, E3, E4, E5, E6, E7)>
Source§type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item, <E4 as Encode>::Item, <E5 as Encode>::Item, <E6 as Encode>::Item, <E7 as Encode>::Item)
type Item = (<E0 as Encode>::Item, <E1 as Encode>::Item, <E2 as Encode>::Item, <E3 as Encode>::Item, <E4 as Encode>::Item, <E5 as Encode>::Item, <E6 as Encode>::Item, <E7 as Encode>::Item)
The type of items to be encoded.
Source§fn 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
Source§fn start_encoding(&mut self, t: Self::Item) -> Result<()>
fn start_encoding(&mut self, t: Self::Item) -> Result<()>
Tries to start encoding the given item. Read more
Source§fn 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
Source§impl<E0, E1> SizedEncode for TupleEncoder<(E0, E1)>where
E0: SizedEncode,
E1: SizedEncode,
impl<E0, E1> SizedEncode for TupleEncoder<(E0, E1)>where
E0: SizedEncode,
E1: SizedEncode,
Source§fn 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.
Source§impl<E0, E1, E2> SizedEncode for TupleEncoder<(E0, E1, E2)>
impl<E0, E1, E2> SizedEncode for TupleEncoder<(E0, E1, E2)>
Source§fn 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.
Source§impl<E0, E1, E2, E3> SizedEncode for TupleEncoder<(E0, E1, E2, E3)>
impl<E0, E1, E2, E3> SizedEncode for TupleEncoder<(E0, E1, E2, E3)>
Source§fn 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.
Source§impl<E0, E1, E2, E3, E4> SizedEncode for TupleEncoder<(E0, E1, E2, E3, E4)>
impl<E0, E1, E2, E3, E4> SizedEncode for TupleEncoder<(E0, E1, E2, E3, E4)>
Source§fn 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.
Source§impl<E0, E1, E2, E3, E4, E5> SizedEncode for TupleEncoder<(E0, E1, E2, E3, E4, E5)>where
E0: SizedEncode,
E1: SizedEncode,
E2: SizedEncode,
E3: SizedEncode,
E4: SizedEncode,
E5: SizedEncode,
impl<E0, E1, E2, E3, E4, E5> SizedEncode for TupleEncoder<(E0, E1, E2, E3, E4, E5)>where
E0: SizedEncode,
E1: SizedEncode,
E2: SizedEncode,
E3: SizedEncode,
E4: SizedEncode,
E5: SizedEncode,
Source§fn 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.
Source§impl<E0, E1, E2, E3, E4, E5, E6> SizedEncode for TupleEncoder<(E0, E1, E2, E3, E4, E5, E6)>where
E0: SizedEncode,
E1: SizedEncode,
E2: SizedEncode,
E3: SizedEncode,
E4: SizedEncode,
E5: SizedEncode,
E6: SizedEncode,
impl<E0, E1, E2, E3, E4, E5, E6> SizedEncode for TupleEncoder<(E0, E1, E2, E3, E4, E5, E6)>where
E0: SizedEncode,
E1: SizedEncode,
E2: SizedEncode,
E3: SizedEncode,
E4: SizedEncode,
E5: SizedEncode,
E6: SizedEncode,
Source§fn 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.
Source§impl<E0, E1, E2, E3, E4, E5, E6, E7> SizedEncode for TupleEncoder<(E0, E1, E2, E3, E4, E5, E6, E7)>where
E0: SizedEncode,
E1: SizedEncode,
E2: SizedEncode,
E3: SizedEncode,
E4: SizedEncode,
E5: SizedEncode,
E6: SizedEncode,
E7: SizedEncode,
impl<E0, E1, E2, E3, E4, E5, E6, E7> SizedEncode for TupleEncoder<(E0, E1, E2, E3, E4, E5, E6, E7)>where
E0: SizedEncode,
E1: SizedEncode,
E2: SizedEncode,
E3: SizedEncode,
E4: SizedEncode,
E5: SizedEncode,
E6: SizedEncode,
E7: SizedEncode,
Source§fn 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<E> Freeze for TupleEncoder<E>where
E: Freeze,
impl<E> RefUnwindSafe for TupleEncoder<E>where
E: RefUnwindSafe,
impl<E> Send for TupleEncoder<E>where
E: Send,
impl<E> Sync for TupleEncoder<E>where
E: Sync,
impl<E> Unpin for TupleEncoder<E>where
E: Unpin,
impl<E> UnwindSafe for TupleEncoder<E>where
E: UnwindSafe,
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
Source§impl<T> EncodeExt for Twhere
T: Encode,
impl<T> EncodeExt for Twhere
T: Encode,
Source§fn with_item(item: Self::Item) -> Result<Self>where
Self: Default,
fn with_item(item: Self::Item) -> Result<Self>where
Self: Default,
Creates a new encoder instance that has the given initial item. Read more
Source§fn map_err<E, F>(self, f: F) -> MapErr<Self, E, F>
fn map_err<E, F>(self, f: F) -> MapErr<Self, E, F>
Creates an encoder for modifying encoding errors produced by
self
. Read moreSource§fn map_from<T, F>(self, f: F) -> MapFrom<Self, T, F>
fn map_from<T, F>(self, f: F) -> MapFrom<Self, T, F>
Creates an encoder that converts items into ones that
suited to the
self
encoder by calling the given function. Read moreSource§fn try_map_from<T, E, F>(self, f: F) -> TryMapFrom<Self, T, E, F>
fn try_map_from<T, E, F>(self, f: F) -> TryMapFrom<Self, T, E, F>
Creates an encoder that tries to convert items into ones that
suited to the
self
encoder by calling the given function. Read moreSource§fn optional(self) -> Optional<Self>
fn optional(self) -> Optional<Self>
Creates an encoder that represents an optional encoder. Read more
Source§fn 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 moreSource§fn 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
Source§fn chain<T: Encode>(self, other: T) -> TupleEncoder<(Self, T)>
fn chain<T: Encode>(self, other: T) -> TupleEncoder<(Self, T)>
Takes two encoders and creates a new encoder that encodes both items in sequence. Read more
Source§fn repeat<I>(self) -> Repeat<Self, I>
fn repeat<I>(self) -> Repeat<Self, I>
Creates an encoder that repeats encoding of
Self::Item
. Read moreSource§fn 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 moreSource§fn 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
Source§impl<T> IoEncodeExt for Twhere
T: Encode,
impl<T> IoEncodeExt for Twhere
T: Encode,
Source§fn encode_to_write_buf<B>(&mut self, buf: &mut WriteBuf<B>) -> Result<()>
fn encode_to_write_buf<B>(&mut self, buf: &mut WriteBuf<B>) -> Result<()>
Encodes the items remaining in the encoder and
writes the encoded bytes to the given write buffer.
Source§fn encode_to_write_buf_async<B>(
&mut self,
buf: &mut WriteBuf<B>,
cx: &mut Context<'_>,
) -> Result<()>
fn encode_to_write_buf_async<B>( &mut self, buf: &mut WriteBuf<B>, cx: &mut Context<'_>, ) -> Result<()>
Encodes the items remaining in the encoder and
writes the encoded bytes to the given write buffer.
If the write buffer is full and the writing cannot be performed,
the given WriteBuf will memorize cx’s
Waker
.
This Waker
’s wake
will later be called when the WriteBuf
regains its free space.