Trait Encode

Source
pub trait Encode<M> {
    type Encode: ?Sized + Encode<M>;

    const IS_BITWISE_ENCODE: bool = false;

    // Required methods
    fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
       where E: Encoder<Mode = M>;
    fn as_encode(&self) -> &Self::Encode;

    // Provided method
    fn size_hint(&self) -> Option<usize> { ... }
}
Expand description

Trait governing how types are encoded.

This is typically implemented automatically using the Encode derive.

§Examples

use musli::Encode;

#[derive(Encode)]
struct MyType {
    data: [u32; 8],
}

Implementing manually:

use musli::{Encode, Encoder};

struct MyType {
    data: [u32; 8],
}

impl<M> Encode<M> for MyType {
    type Encode = Self;

    #[inline]
    fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
    where
        E: Encoder<Mode = M>,
    {
        encoder.encode(&self.data)
    }

    #[inline]
    fn as_encode(&self) -> &Self::Encode {
        self
    }
}

Provided Associated Constants§

Source

const IS_BITWISE_ENCODE: bool = false

Whether the type is packed. Packed types can be bitwise copied if the representation of the serialization format is identical to the memory layout of the type.

Note that setting this to true has safety implications, since it implies that assuming the type is correctly aligned it can be validly bitwise copied when encoded. Setting it to false is always safe.

This being set to true also implies that the type is Copy, and must not have a Drop implementation.

Required Associated Types§

Source

type Encode: ?Sized + Encode<M>

The underlying type being encoded.

This is used to “peek through” types like references being encoded.

Required Methods§

Source

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Encode the given output.

Source

fn as_encode(&self) -> &Self::Encode

Coerce into the underlying value being encoded.

Provided Methods§

Source

fn size_hint(&self) -> Option<usize>

The number of fields in the type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Encode<Binary> for Ipv4Addr

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Ipv4Addr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl Encode<Binary> for Ipv6Addr

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Ipv6Addr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = Binary>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl Encode<Binary> for SocketAddrV4

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = SocketAddrV4

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = Binary>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl Encode<Binary> for SocketAddrV6

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = SocketAddrV6

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = Binary>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl Encode<Text> for Ipv4Addr

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Ipv4Addr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl Encode<Text> for Ipv6Addr

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Ipv6Addr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = Text>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl Encode<Text> for SocketAddrV4

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = SocketAddrV4

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = Text>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl Encode<Text> for SocketAddrV6

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = SocketAddrV6

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = Text>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<'de, M, K, V> Encode<M> for BTreeMap<K, V>
where K: Encode<M>, V: Encode<M>,

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = BTreeMap<K, V>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<'de, M, K, V, S> Encode<M> for HashMap<K, V, S>
where K: Encode<M>, V: Encode<M>, S: BuildHasher + Default,

Available on crate features alloc and std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = HashMap<K, V, S>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for Cow<'_, str>

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = str

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for Cow<'_, CStr>

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = CStr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for IpAddr
where IpAddrTag: Encode<M>, Ipv4Addr: Encode<M>, Ipv6Addr: Encode<M>,

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = IpAddr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for SocketAddr
where SocketAddrTag: Encode<M>, SocketAddrV4: Encode<M>, SocketAddrV6: Encode<M>,

Available on crate feature std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = SocketAddr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for bool

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = bool

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for char

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = char

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for f32

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = f32

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for f64

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = f64

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for i8

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = i8

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for i16

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = i16

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for i32

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = i32

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for i64

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = i64

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for i128

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = i128

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for isize

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = isize

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for str

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = str

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for u8

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = u8

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for u16

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = u16

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for u32

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = u32

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for u64

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = u64

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for u128

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = u128

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for ()

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = ()

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for usize

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = usize

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for CString

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = CStr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for String

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = str

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for CStr

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = CStr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for RangeFull

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = RangeFull

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for OsStr
where PlatformTag: Encode<M>,

Available on crate feature std and (Unix or Windows) and crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = OsStr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for OsString
where PlatformTag: Encode<M>,

Available on crate feature std and (Unix or Windows) and crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = OsStr

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for Path
where PlatformTag: Encode<M>,

Available on crate feature std and (Unix or Windows) and crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Path

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for PathBuf
where PlatformTag: Encode<M>,

Available on crate feature std and (Unix or Windows) and crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = PathBuf

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroI8

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<i8>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroI16

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<i16>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroI32

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<i32>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroI64

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<i64>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroI128

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<i128>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroIsize

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<isize>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroU8

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<u8>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroU16

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<u16>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroU32

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<u32>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroU64

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<u64>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroU128

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<u128>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M> Encode<M> for NonZeroUsize

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = NonZero<usize>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T0: Encode<M>, T1: Encode<M>, T2: Encode<M>, T3: Encode<M>, T4: Encode<M>, T5: Encode<M>, T6: Encode<M>, T7: Encode<M>, T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

impl<M, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T1: Encode<M>, T2: Encode<M>, T3: Encode<M>, T4: Encode<M>, T5: Encode<M>, T6: Encode<M>, T7: Encode<M>, T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

impl<M, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T2: Encode<M>, T3: Encode<M>, T4: Encode<M>, T5: Encode<M>, T6: Encode<M>, T7: Encode<M>, T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

impl<M, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T3: Encode<M>, T4: Encode<M>, T5: Encode<M>, T6: Encode<M>, T7: Encode<M>, T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

impl<M, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T4: Encode<M>, T5: Encode<M>, T6: Encode<M>, T7: Encode<M>, T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

impl<M, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T5: Encode<M>, T6: Encode<M>, T7: Encode<M>, T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T6: Encode<M>, T7: Encode<M>, T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T7, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T7: Encode<M>, T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T7, T8, T9, T10, T11, T12, T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T8, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T8, T9, T10, T11, T12, T13, T14, T15)
where T8: Encode<M>, T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T8, T9, T10, T11, T12, T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T9, T10, T11, T12, T13, T14, T15> Encode<M> for (T9, T10, T11, T12, T13, T14, T15)
where T9: Encode<M>, T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T9, T10, T11, T12, T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T10, T11, T12, T13, T14, T15> Encode<M> for (T10, T11, T12, T13, T14, T15)
where T10: Encode<M>, T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T10, T11, T12, T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T11, T12, T13, T14, T15> Encode<M> for (T11, T12, T13, T14, T15)
where T11: Encode<M>, T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T11, T12, T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T12, T13, T14, T15> Encode<M> for (T12, T13, T14, T15)
where T12: Encode<M>, T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T12, T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T13, T14, T15> Encode<M> for (T13, T14, T15)
where T13: Encode<M>, T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T13, T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T14, T15> Encode<M> for (T14, T15)
where T14: Encode<M>, T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T14, T15)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T15> Encode<M> for (T15,)
where T15: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = (T15,)

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for [T]
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = [T]

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for Box<T>
where T: ?Sized + Encode<M>,

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = T

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for BinaryHeap<T>
where T: Encode<M>,

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = BinaryHeap<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for BTreeSet<T>
where T: Encode<M>,

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = BTreeSet<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for VecDeque<T>
where T: Encode<M>,

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = VecDeque<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for Rc<T>
where T: ?Sized + Encode<M>,

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = T

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for Arc<T>
where T: ?Sized + Encode<M>,

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = T

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for Vec<T>
where T: Encode<M>,

Available on crate feature alloc only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Vec<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for Range<T>
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Range<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for RangeFrom<T>
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = RangeFrom<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for RangeInclusive<T>
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = RangeInclusive<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for RangeTo<T>
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = RangeTo<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T> Encode<M> for RangeToInclusive<T>
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = RangeToInclusive<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T, S> Encode<M> for HashSet<T, S>
where T: Encode<M>, S: BuildHasher + Default,

Available on crate features alloc and std only.
Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = HashSet<T, S>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<M, T, const N: usize> Encode<M> for [T; N]
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool

Source§

type Encode = [T; N]

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<T, M> Encode<M> for Option<T>
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Option<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<T, M> Encode<M> for &T
where T: ?Sized + Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = T

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn size_hint(&self) -> Option<usize>

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<T, M> Encode<M> for &mut T
where T: ?Sized + Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = T

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn size_hint(&self) -> Option<usize>

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<T, M> Encode<M> for PhantomData<T>

Source§

const IS_BITWISE_ENCODE: bool = true

Source§

type Encode = PhantomData<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<T, M> Encode<M> for Wrapping<T>
where T: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = T::IS_BITWISE_ENCODE

Source§

type Encode = Wrapping<T>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Source§

impl<T, U, M> Encode<M> for Result<T, U>
where T: Encode<M>, U: Encode<M>, ResultTag: Encode<M>,

Source§

const IS_BITWISE_ENCODE: bool = false

Source§

type Encode = Result<T, U>

Source§

fn encode<E>(&self, encoder: E) -> Result<(), E::Error>
where E: Encoder<Mode = M>,

Source§

fn as_encode(&self) -> &Self::Encode

Implementors§

Source§

impl<M, A> Encode<M> for musli_core::alloc::String<A>
where A: Allocator,

Source§

impl<M, T, A> Encode<M> for musli_core::alloc::Vec<T, A>
where T: Encode<M>, A: Allocator,