pub trait EncodeAsType {
    // Required method
    fn encode_as_type_to(
        &self,
        type_id: u32,
        types: &PortableRegistry,
        out: &mut Vec<u8>
    ) -> Result<(), Error>;

    // Provided method
    fn encode_as_type(
        &self,
        type_id: u32,
        types: &PortableRegistry
    ) -> Result<Vec<u8>, Error> { ... }
}
Expand description

This trait signals that some static type can possibly be SCALE encoded given some type_id and PortableRegistry which dictates the expected encoding.

Required Methods§

source

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

Given some type_id, types, a context and some output target for the SCALE encoded bytes, attempt to SCALE encode the current value into the type given by type_id.

Provided Methods§

source

fn encode_as_type( &self, type_id: u32, types: &PortableRegistry ) -> Result<Vec<u8>, Error>

This is a helper function which internally calls EncodeAsType::encode_as_type_to. Prefer to implement that instead.

Implementations on Foreign Types§

source§

impl EncodeAsType for NonZeroI32

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for u64

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B> EncodeAsType for (A, B)where A: EncodeAsType, B: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F> EncodeAsType for (A, B, C, D, E, F)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K, L)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType, L: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D> EncodeAsType for (A, B, C, D)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T: EncodeAsType, E: EncodeAsType> EncodeAsType for Result<T, E>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I> EncodeAsType for (A, B, C, D, E, F, G, H, I)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for ()

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T: EncodeAsType> EncodeAsType for Arc<T>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for u128

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for str

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for char

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for i8

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<V> EncodeAsType for VecDeque<V>where V: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<'a, T> EncodeAsType for &'a Twhere T: EncodeAsType + ?Sized,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType, L: EncodeAsType, M: EncodeAsType, N: EncodeAsType, O: EncodeAsType, P: EncodeAsType, Q: EncodeAsType, R: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroU8

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for Duration

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<'a, T> EncodeAsType for Cow<'a, T>where T: 'a + EncodeAsType + ToOwned + ?Sized,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<K> EncodeAsType for BTreeSet<K>where K: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G> EncodeAsType for (A, B, C, D, E, F, G)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T> EncodeAsType for [T]where T: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for i16

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<V> EncodeAsType for LinkedList<V>where V: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<const N: usize, T: EncodeAsType> EncodeAsType for [T; N]

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E> EncodeAsType for (A, B, C, D, E)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for i64

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for String

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for Bits

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroI128

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType, L: EncodeAsType, M: EncodeAsType, N: EncodeAsType, O: EncodeAsType, P: EncodeAsType, Q: EncodeAsType, R: EncodeAsType, S: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<V> EncodeAsType for BinaryHeap<V>where V: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<K: AsRef<str>, V: EncodeAsType> EncodeAsType for BTreeMap<K, V>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for u16

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroU16

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<V> EncodeAsType for Vec<V>where V: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for i32

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T: EncodeAsType> EncodeAsType for Option<T>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for bool

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for u32

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for H128

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J> EncodeAsType for (A, B, C, D, E, F, G, H, I, J)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C> EncodeAsType for (A, B, C)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T: EncodeAsType> EncodeAsType for Compact<T>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for H768

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for H512

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroU128

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T: EncodeAsType> EncodeAsType for Rc<T>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroI64

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T> EncodeAsType for PhantomData<T>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType, L: EncodeAsType, M: EncodeAsType, N: EncodeAsType, O: EncodeAsType, P: EncodeAsType, Q: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType, L: EncodeAsType, M: EncodeAsType, N: EncodeAsType, O: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T: EncodeAsType> EncodeAsType for Range<T>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType, L: EncodeAsType, M: EncodeAsType, N: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H> EncodeAsType for (A, B, C, D, E, F, G, H)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for i128

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for H384

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for H256

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroI8

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for H160

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T: EncodeAsType> EncodeAsType for RangeInclusive<T>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType, L: EncodeAsType, M: EncodeAsType, N: EncodeAsType, O: EncodeAsType, P: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<T: EncodeAsType> EncodeAsType for Box<T>

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A, B, C, D, E, F, G, H, I, J, K, L, M> EncodeAsType for (A, B, C, D, E, F, G, H, I, J, K, L, M)where A: EncodeAsType, B: EncodeAsType, C: EncodeAsType, D: EncodeAsType, E: EncodeAsType, F: EncodeAsType, G: EncodeAsType, H: EncodeAsType, I: EncodeAsType, J: EncodeAsType, K: EncodeAsType, L: EncodeAsType, M: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroU64

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroI16

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for u8

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl<A> EncodeAsType for (A,)where A: EncodeAsType,

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

source§

impl EncodeAsType for NonZeroU32

source§

fn encode_as_type_to( &self, type_id: u32, types: &PortableRegistry, out: &mut Vec<u8> ) -> Result<(), Error>

Implementors§

source§

impl<'a, Vals> EncodeAsType for Composite<Vals>where Vals: ExactSizeIterator<Item = (Option<&'a str>, &'a dyn EncodeAsType)> + Clone,