Trait slot_range_helper::Encode
source · pub trait Encode {
// Provided methods
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<T> Encode for RangeInclusive<T>where
T: Encode,
impl<T> Encode for RangeInclusive<T>where T: Encode,
source§impl Encode for NonZeroI64
impl Encode for NonZeroI64
source§impl Encode for NonZeroU128
impl Encode for NonZeroU128
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<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<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<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<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 Encode for NonZeroU32
impl Encode for NonZeroU32
source§impl<T> Encode for PhantomData<T>
impl<T> Encode for PhantomData<T>
source§impl Encode for NonZeroU16
impl Encode for NonZeroU16
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<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 Encode for NonZeroI32
impl Encode for NonZeroI32
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 NonZeroI128
impl Encode for NonZeroI128
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<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 NonZeroU64
impl Encode for NonZeroU64
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<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 Encode for NonZeroI16
impl Encode for NonZeroI16
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<B> Encode for BlockAndTimeDeadline<B>where
B: BlockNumberProvider,
<B as BlockNumberProvider>::BlockNumber: Encode,
impl<B> Encode for BlockAndTimeDeadline<B>where B: BlockNumberProvider, <B as BlockNumberProvider>::BlockNumber: Encode,
source§impl Encode for UintAuthorityId
impl Encode for UintAuthorityId
source§impl Encode for TransactionSource
impl Encode for TransactionSource
source§impl Encode for DispatchError
impl Encode for DispatchError
source§impl Encode for ValidTransaction
impl Encode for ValidTransaction
source§impl Encode for TokenError
impl Encode for TokenError
source§impl Encode for OpaqueExtrinsic
impl Encode for OpaqueExtrinsic
source§impl<Xt> Encode for ExtrinsicWrapper<Xt>where
Xt: Encode,
impl<Xt> Encode for ExtrinsicWrapper<Xt>where Xt: 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 LookupError
impl Encode for LookupError
source§impl Encode for AnySignature
impl Encode for AnySignature
source§impl<Number, Hash> Encode for Header<Number, Hash>where
Number: Copy + Into<U256> + TryFrom<U256> + HasCompact,
Hash: Hash,
<Hash as Hash>::Output: Encode,
impl<Number, Hash> Encode for Header<Number, Hash>where Number: Copy + Into<U256> + TryFrom<U256> + HasCompact, Hash: Hash, <Hash as Hash>::Output: Encode,
source§impl Encode for TransactionalError
impl Encode for TransactionalError
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 InvalidTransaction
impl Encode for InvalidTransaction
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 Encode for UnknownTransaction
impl Encode for UnknownTransaction
source§impl Encode for TransactionValidityError
impl Encode for TransactionValidityError
source§impl Encode for TestSignature
impl Encode for TestSignature
source§impl<Info> Encode for DispatchErrorWithPostInfo<Info>where
Info: Eq + PartialEq<Info> + Clone + Copy + Encode + Decode + Printable,
impl<Info> Encode for DispatchErrorWithPostInfo<Info>where Info: Eq + PartialEq<Info> + Clone + Copy + Encode + Decode + Printable,
source§impl Encode for ModuleError
impl Encode for ModuleError
source§impl<Block> Encode for SignedBlock<Block>where
Block: Encode,
impl<Block> Encode for SignedBlock<Block>where Block: Encode,
source§impl Encode for ModuleError
impl Encode for ModuleError
source§impl Encode for Justifications
impl Encode for Justifications
source§impl<Header, Extrinsic> Encode for Block<Header, Extrinsic>where
Extrinsic: MaybeSerialize,
Header: Encode,
Vec<Extrinsic, Global>: Encode,
impl<Header, Extrinsic> Encode for Block<Header, Extrinsic>where Extrinsic: MaybeSerialize, Header: Encode, Vec<Extrinsic, Global>: Encode,
source§impl Encode for MultiSignature
impl Encode for MultiSignature
source§impl<Address, Call, Signature, Extra> Encode for UncheckedExtrinsic<Address, Call, Signature, Extra>where
Address: Encode,
Signature: Encode,
Call: Encode,
Extra: SignedExtension,
impl<Address, Call, Signature, Extra> Encode for UncheckedExtrinsic<Address, Call, Signature, Extra>where Address: Encode, Signature: Encode, Call: Encode, Extra: SignedExtension,
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.