pub trait SolTopicEncode: Sealed {
// Required methods
fn topic_preimage(&self, buffer: &mut Vec<u8>);
fn default_topic_preimage(buffer: &mut Vec<u8>);
fn topic_preimage_size(&self) -> usize;
fn default_topic_preimage_size() -> usize;
// Provided method
fn encode_topic<H>(&self, hasher: H) -> [u8; 32]
where H: Fn(&[u8], &mut [u8; 32]) { ... }
}
Expand description
Solidity ABI encode this type as a topic (i.e. an indexed event parameter).
§References
- https://docs.soliditylang.org/en/latest/abi-spec.html#events
- https://docs.soliditylang.org/en/latest/abi-spec.html#indexed-event-encoding
§Note
This trait is sealed and cannot be implemented for types outside ink_primitives
.
Required Methods§
Sourcefn topic_preimage(&self, buffer: &mut Vec<u8>)
fn topic_preimage(&self, buffer: &mut Vec<u8>)
Encode this type as input bytes for the hasher, when this type is member of a complex topic type (e.g. a member of array or struct/tuple).
Sourcefn default_topic_preimage(buffer: &mut Vec<u8>)
fn default_topic_preimage(buffer: &mut Vec<u8>)
Self::topic_preimage
equivalent for the default value representation of this
type.
Sourcefn topic_preimage_size(&self) -> usize
fn topic_preimage_size(&self) -> usize
Size in bytes of the Self::topic_preimage
encoding of this type.
Sourcefn default_topic_preimage_size() -> usize
fn default_topic_preimage_size() -> usize
Self::topic_preimage_size
equivalent for the default value representation of
this type.
Provided Methods§
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.