Trait parity_scale_codec::Encode [−][src]
pub trait Encode { fn size_hint(&self) -> usize { ... } fn encode_to<T: Output + ?Sized>(&self, dest: &mut T) { ... } fn encode(&self) -> Vec<u8>ⓘ { ... } fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R { ... } fn encoded_size(&self) -> usize { ... } }
Trait that allows zero-copy write of value-references to slices in LE format.
Implementations should override using_encoded
for value types and encode_to
and size_hint
for allocating types.
Wrapper types should override all methods.
Provided methods
fn size_hint(&self) -> usize
[src]
If possible give a hint of expected size of the encoding.
This method is used inside default implementation of encode
to avoid re-allocations.
fn encode_to<T: Output + ?Sized>(&self, dest: &mut T)
[src]
Convert self to a slice and append it to the destination.
fn encode(&self) -> Vec<u8>ⓘ
[src]
Convert self to an owned vector.
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
[src]
Convert self to a slice and then invoke the given closure with it.
fn encoded_size(&self) -> usize
[src]
Implementations on Foreign Types
impl<T: Encode, E: Encode> Encode for Result<T, E>
[src]
impl<T: Encode, E: Encode> Encode for Result<T, E>
[src]impl<T: Encode> Encode for Option<T>
[src]
impl<T: Encode> Encode for Option<T>
[src]impl Encode for NonZeroI8
[src]
impl Encode for NonZeroI8
[src]impl Encode for NonZeroI16
[src]
impl Encode for NonZeroI16
[src]impl Encode for NonZeroI32
[src]
impl Encode for NonZeroI32
[src]impl Encode for NonZeroI64
[src]
impl Encode for NonZeroI64
[src]impl Encode for NonZeroI128
[src]
impl Encode for NonZeroI128
[src]impl Encode for NonZeroU8
[src]
impl Encode for NonZeroU8
[src]impl Encode for NonZeroU16
[src]
impl Encode for NonZeroU16
[src]impl Encode for NonZeroU32
[src]
impl Encode for NonZeroU32
[src]impl Encode for NonZeroU64
[src]
impl Encode for NonZeroU64
[src]impl Encode for NonZeroU128
[src]
impl Encode for NonZeroU128
[src]impl<T: Encode, const N: usize> Encode for [T; N]
[src]
impl<T: Encode, const N: usize> Encode for [T; N]
[src]impl Encode for str
[src]
impl Encode for str
[src]impl<T: Encode> Encode for [T]
[src]
impl<T: Encode> Encode for [T]
[src]impl<K: Encode, V: Encode> Encode for BTreeMap<K, V>
[src]
impl<K: Encode, V: Encode> Encode for BTreeMap<K, V>
[src]impl<T: Encode> Encode for BTreeSet<T>
[src]
impl<T: Encode> Encode for BTreeSet<T>
[src]impl<T: Encode> Encode for LinkedList<T>
[src]
impl<T: Encode> Encode for LinkedList<T>
[src]impl<T: Encode> Encode for BinaryHeap<T>
[src]
impl<T: Encode> Encode for BinaryHeap<T>
[src]impl<T: Encode> Encode for VecDeque<T>
[src]
impl<T: Encode> Encode for VecDeque<T>
[src]impl Encode for ()
[src]
impl Encode for ()
[src]impl<A0: Encode, B0: Encode, C0: Encode, D0: Encode, E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (A0, B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<A0: Encode, B0: Encode, C0: Encode, D0: Encode, E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (A0, B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<B0: Encode, C0: Encode, D0: Encode, E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<B0: Encode, C0: Encode, D0: Encode, E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<C0: Encode, D0: Encode, E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<C0: Encode, D0: Encode, E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<D0: Encode, E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<D0: Encode, E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<E0: Encode, F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<F0: Encode, G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<G0: Encode, H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<H0: Encode, I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<I0: Encode, J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<J0: Encode, K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (J0, K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (K0, L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<K0: Encode, L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (K0, L0, M0, N0, O0, P0, Q0, R0)
[src]impl<L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (L0, M0, N0, O0, P0, Q0, R0)
[src]
impl<L0: Encode, M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (L0, M0, N0, O0, P0, Q0, R0)
[src]impl<M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (M0, N0, O0, P0, Q0, R0)
[src]
impl<M0: Encode, N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (M0, N0, O0, P0, Q0, R0)
[src]impl<N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (N0, O0, P0, Q0, R0)
[src]
impl<N0: Encode, O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (N0, O0, P0, Q0, R0)
[src]impl<O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (O0, P0, Q0, R0)
[src]
impl<O0: Encode, P0: Encode, Q0: Encode, R0: Encode> Encode for (O0, P0, Q0, R0)
[src]impl<P0: Encode, Q0: Encode, R0: Encode> Encode for (P0, Q0, R0)
[src]
impl<P0: Encode, Q0: Encode, R0: Encode> Encode for (P0, Q0, R0)
[src]impl<Q0: Encode, R0: Encode> Encode for (Q0, R0)
[src]
impl<Q0: Encode, R0: Encode> Encode for (Q0, R0)
[src]impl<R0: Encode> Encode for (R0,)
[src]
impl<R0: Encode> Encode for (R0,)
[src]impl Encode for u16
[src]
impl Encode for u16
[src]impl Encode for u32
[src]
impl Encode for u32
[src]impl Encode for u64
[src]
impl Encode for u64
[src]impl Encode for u128
[src]
impl Encode for u128
[src]impl Encode for i16
[src]
impl Encode for i16
[src]impl Encode for i32
[src]
impl Encode for i32
[src]impl Encode for i64
[src]
impl Encode for i64
[src]impl Encode for i128
[src]
impl Encode for i128
[src]impl Encode for u8
[src]
impl Encode for u8
[src]impl Encode for i8
[src]
impl Encode for i8
[src]impl Encode for bool
[src]
impl Encode for bool
[src]impl Encode for Duration
[src]
impl Encode for Duration
[src]Implementors
impl Encode for OptionBool
[src]
impl Encode for OptionBool
[src]impl<T: ?Sized, X> Encode for X where
T: Encode,
X: WrapperTypeEncode<Target = T>,
[src]
impl<T: ?Sized, X> Encode for X where
T: Encode,
X: WrapperTypeEncode<Target = T>,
[src]