pub trait Encode<W: Write> {
// Required method
fn encode(&self, encoder: &mut Encoder<'_, W>) -> EncodingResult<()>;
}Expand description
A binary data structure specification which can be encoded into its binary representation.
Implementations that need to seek should implement for W: Write + Seek.
You should keep your implementation as general as possible and avoid
implementing for a R = ConcreteType if possible
Required Methods§
Sourcefn encode(&self, encoder: &mut Encoder<'_, W>) -> EncodingResult<()>
fn encode(&self, encoder: &mut Encoder<'_, W>) -> EncodingResult<()>
Encodes self into its binary format.
Calling encode multiple times on the same value without
changing the encoder settings or the value itself in-between calls should produce
the same output.
If the result is Ok, implementations should guarantee that the state of the encoder is preserved. If the result is Err, no guarantees are made about the state of the encoder, and users should reset it before reuse.
Implementations on Foreign Types§
Source§impl<W: Write> Encode<W> for SocketAddr
Available on crate feature std only.
impl<W: Write> Encode<W> for SocketAddr
Available on crate feature
std only.Source§impl<W: Write> Encode<W> for SocketAddrV4
Available on crate feature std only.
impl<W: Write> Encode<W> for SocketAddrV4
Available on crate feature
std only.Source§impl<W: Write> Encode<W> for SocketAddrV6
Available on crate feature std only.
impl<W: Write> Encode<W> for SocketAddrV6
Available on crate feature
std only.Source§impl<W: Write> Encode<W> for SystemTime
Available on crate feature std only.
impl<W: Write> Encode<W> for SystemTime
Available on crate feature
std only.Source§impl<W: Write> Encode<W> for NonZeroI16
impl<W: Write> Encode<W> for NonZeroI16
Source§impl<W: Write> Encode<W> for NonZeroI32
impl<W: Write> Encode<W> for NonZeroI32
Source§impl<W: Write> Encode<W> for NonZeroI64
impl<W: Write> Encode<W> for NonZeroI64
Source§impl<W: Write> Encode<W> for NonZeroI128
impl<W: Write> Encode<W> for NonZeroI128
Source§impl<W: Write> Encode<W> for NonZeroIsize
impl<W: Write> Encode<W> for NonZeroIsize
Source§impl<W: Write> Encode<W> for NonZeroU16
impl<W: Write> Encode<W> for NonZeroU16
Source§impl<W: Write> Encode<W> for NonZeroU32
impl<W: Write> Encode<W> for NonZeroU32
Source§impl<W: Write> Encode<W> for NonZeroU64
impl<W: Write> Encode<W> for NonZeroU64
Source§impl<W: Write> Encode<W> for NonZeroU128
impl<W: Write> Encode<W> for NonZeroU128
Source§impl<W: Write> Encode<W> for NonZeroUsize
impl<W: Write> Encode<W> for NonZeroUsize
Source§impl<W: Write, K: Encode<W>, V: Encode<W>> Encode<W> for BTreeMap<K, V>
Available on crate feature alloc only.
impl<W: Write, K: Encode<W>, V: Encode<W>> Encode<W> for BTreeMap<K, V>
Available on crate feature
alloc only.Source§impl<W: Write, K: Encode<W>, V: Encode<W>> Encode<W> for HashMap<K, V>
Available on crate feature std only.
impl<W: Write, K: Encode<W>, V: Encode<W>> Encode<W> for HashMap<K, V>
Available on crate feature
std only.Source§impl<W: Write, T> Encode<W> for PhantomData<T>
impl<W: Write, T> Encode<W> for PhantomData<T>
Source§impl<W: Write, T: Encode<W>> Encode<W> for BinaryHeap<T>
Available on crate feature alloc only.
impl<W: Write, T: Encode<W>> Encode<W> for BinaryHeap<T>
Available on crate feature
alloc only.Source§impl<W: Write, T: Encode<W>> Encode<W> for LinkedList<T>
Available on crate feature alloc only.
impl<W: Write, T: Encode<W>> Encode<W> for LinkedList<T>
Available on crate feature
alloc only.Source§impl<W: Write, T: Encode<W>> Encode<W> for Arc<T>
Available on crate features alloc and sync only.
impl<W: Write, T: Encode<W>> Encode<W> for Arc<T>
Available on crate features
alloc and sync only.