Trait EncodeKeyLike

Source
pub trait EncodeKeyLike<Ref: ?Sized, Target> {
    // Required method
    fn encode_key_like(&self, borrowed: &Ref) -> Vec<u8> ;
}
Expand description

A trait for codecs which know how to serialize a type Ref as if it were some other type Target.

A good example of this is BorshCodec, which knows how to serialize a [T;N] as if it were a Vec<T> even though the two types have different encodings by default.

Required Methods§

Source

fn encode_key_like(&self, borrowed: &Ref) -> Vec<u8>

Encodes a reference to Ref as if it were a reference to Target.

Implementors§

Source§

impl<C, T> EncodeKeyLike<T, T> for C
where C: StateKeyCodec<T>,

Source§

impl<T> EncodeKeyLike<[T], Vec<T>> for BorshCodec
where T: BorshSerialize,