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 Cwhere C: StateKeyCodec<T>,

source§

impl<T> EncodeKeyLike<[T], Vec<T, Global>> for BorshCodecwhere T: BorshSerialize,