Trait slot_range_helper::Encode
source · pub trait Encode {
fn size_hint(&self) -> usize { ... }
fn encode_to<T>(&self, dest: &mut T)
where
T: Output + ?Sized,
{ ... }
fn encode(&self) -> Vec<u8, Global> ⓘ { ... }
fn using_encoded<R, F>(&self, f: F) -> R
where
F: FnOnce(&[u8]) -> R,
{ ... }
fn encoded_size(&self) -> usize { ... }
}
Expand description
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§
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding.
This method is used inside default implementation of encode
to avoid re-allocations.
sourcefn encode_to<T>(&self, dest: &mut T)where
T: Output + ?Sized,
fn encode_to<T>(&self, dest: &mut T)where
T: Output + ?Sized,
Convert self to a slice and append it to the destination.
sourcefn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
sourcefn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Implementations on Foreign Types§
source§impl<J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
J0: Encode,
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
J0: Encode,
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl<K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (K0, L0, M0, N0, O0, P0, Q0, R0)where
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (K0, L0, M0, N0, O0, P0, Q0, R0)where
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl Encode for NonZeroI128
impl Encode for NonZeroI128
source§impl Encode for NonZeroI16
impl Encode for NonZeroI16
source§impl<N0, O0, P0, Q0, R0> Encode for (N0, O0, P0, Q0, R0)where
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<N0, O0, P0, Q0, R0> Encode for (N0, O0, P0, Q0, R0)where
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl<D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
impl<D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
source§impl Encode for NonZeroU32
impl Encode for NonZeroU32
source§impl<E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
impl<E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
source§impl<O0, P0, Q0, R0> Encode for (O0, P0, Q0, R0)where
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<O0, P0, Q0, R0> Encode for (O0, P0, Q0, R0)where
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl<T> Encode for PhantomData<T>
impl<T> Encode for PhantomData<T>
source§impl<I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
I0: Encode,
J0: Encode,
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
I0: Encode,
J0: Encode,
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl Encode for NonZeroI32
impl Encode for NonZeroI32
source§impl<A0, B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (A0, B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
impl<A0, B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (A0, B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
source§impl<T> Encode for RangeInclusive<T>where
T: Encode,
impl<T> Encode for RangeInclusive<T>where
T: Encode,
source§impl<F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
impl<F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
source§impl<C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
impl<C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
source§impl<G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
G0: Encode,
H0: Encode,
I0: Encode,
J0: Encode,
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
G0: Encode,
H0: Encode,
I0: Encode,
J0: Encode,
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl Encode for NonZeroU64
impl Encode for NonZeroU64
source§impl Encode for NonZeroU128
impl Encode for NonZeroU128
source§impl<T> Encode for BinaryHeap<T>where
T: Encode,
impl<T> Encode for BinaryHeap<T>where
T: Encode,
source§impl<L0, M0, N0, O0, P0, Q0, R0> Encode for (L0, M0, N0, O0, P0, Q0, R0)where
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<L0, M0, N0, O0, P0, Q0, R0> Encode for (L0, M0, N0, O0, P0, Q0, R0)where
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl<B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
impl<B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (B0, C0, D0, E0, F0, G0, H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
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,
source§impl Encode for NonZeroU16
impl Encode for NonZeroU16
source§impl<H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
H0: Encode,
I0: Encode,
J0: Encode,
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0> Encode for (H0, I0, J0, K0, L0, M0, N0, O0, P0, Q0, R0)where
H0: Encode,
I0: Encode,
J0: Encode,
K0: Encode,
L0: Encode,
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl Encode for NonZeroI64
impl Encode for NonZeroI64
source§impl<M0, N0, O0, P0, Q0, R0> Encode for (M0, N0, O0, P0, Q0, R0)where
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
impl<M0, N0, O0, P0, Q0, R0> Encode for (M0, N0, O0, P0, Q0, R0)where
M0: Encode,
N0: Encode,
O0: Encode,
P0: Encode,
Q0: Encode,
R0: Encode,
source§impl<T> Encode for LinkedList<T>where
T: Encode,
impl<T> Encode for LinkedList<T>where
T: Encode,
source§impl Encode for TokenError
impl Encode for TokenError
source§impl Encode for Justifications
impl Encode for Justifications
source§impl<K, V, S> Encode for BoundedBTreeMap<K, V, S>where
BTreeMap<K, V, Global>: Encode,
PhantomData<S>: Encode,
impl<K, V, S> Encode for BoundedBTreeMap<K, V, S>where
BTreeMap<K, V, Global>: Encode,
PhantomData<S>: Encode,
source§impl<Call, Extra> Encode for TestXt<Call, Extra>where
Option<(u64, Extra)>: Encode,
Call: Encode,
impl<Call, Extra> Encode for TestXt<Call, Extra>where
Option<(u64, Extra)>: Encode,
Call: Encode,
source§impl Encode for MultiSignature
impl Encode for MultiSignature
source§impl Encode for TestSignature
impl Encode for TestSignature
source§impl Encode for LookupError
impl Encode for LookupError
source§impl<AccountId, AccountIndex> Encode for MultiAddress<AccountId, AccountIndex>where
AccountId: Encode,
AccountIndex: HasCompact,
impl<AccountId, AccountIndex> Encode for MultiAddress<AccountId, AccountIndex>where
AccountId: Encode,
AccountIndex: HasCompact,
source§impl Encode for DispatchError
impl Encode for DispatchError
source§impl<Block> Encode for SignedBlock<Block>where
Block: Encode,
impl<Block> Encode for SignedBlock<Block>where
Block: Encode,
source§impl Encode for TransactionSource
impl Encode for TransactionSource
source§impl<Xt> Encode for ExtrinsicWrapper<Xt>where
Xt: Encode,
impl<Xt> Encode for ExtrinsicWrapper<Xt>where
Xt: Encode,
source§impl Encode for TransactionalError
impl Encode for TransactionalError
source§impl<'a, T, S> Encode for BoundedSlice<'a, T, S>where
T: Encode,
&'a [T]: Encode,
PhantomData<S>: Encode,
impl<'a, T, S> Encode for BoundedSlice<'a, T, S>where
T: Encode,
&'a [T]: Encode,
PhantomData<S>: Encode,
source§impl Encode for DispatchError
impl Encode for DispatchError
source§impl<Block> Encode for BlockId<Block>where
Block: Block,
<Block as Block>::Hash: Encode,
<<Block as Block>::Header as Header>::Number: Encode,
impl<Block> Encode for BlockId<Block>where
Block: Block,
<Block as Block>::Hash: Encode,
<<Block as Block>::Header as Header>::Number: Encode,
source§impl<Call, Extra> Encode for SignedPayload<Call, Extra>where
Call: Encode,
Extra: SignedExtension,
impl<Call, Extra> Encode for SignedPayload<Call, Extra>where
Call: Encode,
Extra: SignedExtension,
source§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
Get an encoded version of this payload.
Payloads longer than 256 bytes are going to be blake2_256
-hashed.