Trait TopicEncoder

Source
pub trait TopicEncoder: Sealed + Sized {
    const REQUIRES_BUFFER: bool;

    // Required methods
    fn encode_topic<T>(value: &T) -> [u8; 32]
       where T: AbiEncodeWith<Self>;
    fn encode_topic_with_hash_buffer<T>(
        value: &T,
        output: &mut [u8; 32],
        buffer: &mut [u8],
    )
       where T: AbiEncodeWith<Self>;
}
Expand description

Specifies the topic (i.e. indexed event parameter) encoding implementation for the given ABI.

Required Associated Constants§

Source

const REQUIRES_BUFFER: bool

True if the topic hashing implementation requires a buffer.

(e.g. when hashing requires calling a pre-compile).

Required Methods§

Source

fn encode_topic<T>(value: &T) -> [u8; 32]
where T: AbiEncodeWith<Self>,

Encodes the value as a topic (i.e. an indexed event parameter).

Source

fn encode_topic_with_hash_buffer<T>( value: &T, output: &mut [u8; 32], buffer: &mut [u8], )
where T: AbiEncodeWith<Self>,

Encodes the value as a topic (i.e. an indexed event parameter), utilizing the given buffer for hashing (if necessary).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl TopicEncoder for Ink

Source§

const REQUIRES_BUFFER: bool = false

Source§

fn encode_topic<T>(value: &T) -> [u8; 32]
where T: AbiEncodeWith<Self>,

Source§

fn encode_topic_with_hash_buffer<T>( _value: &T, _output: &mut [u8; 32], _buffer: &mut [u8], )
where T: AbiEncodeWith<Self>,

Source§

impl TopicEncoder for Sol

Source§

const REQUIRES_BUFFER: bool = false

Source§

fn encode_topic<T>(value: &T) -> [u8; 32]
where T: AbiEncodeWith<Self>,

Source§

fn encode_topic_with_hash_buffer<T>( _value: &T, _output: &mut [u8; 32], _buffer: &mut [u8], )
where T: AbiEncodeWith<Self>,

Implementors§