pub trait EventTopic: SolType {
// Required methods
fn topic_preimage_length(rust: &Self::RustType) -> usize;
fn encode_topic_preimage(rust: &Self::RustType, out: &mut Vec<u8>);
fn encode_topic(rust: &Self::RustType) -> WordToken;
}
Expand description
A Solidity event topic.
These types implement a special encoding used only in Solidity indexed event parameters.
For more details, see the Solidity reference.
§Implementer’s Guide
It should not be necessary to implement this trait manually. Instead, use
the sol!
procedural macro to parse Solidity syntax into
types that implement this trait.
Required Methods§
Sourcefn topic_preimage_length(rust: &Self::RustType) -> usize
fn topic_preimage_length(rust: &Self::RustType) -> usize
The number of bytes this type occupies in another topic’s preimage, usually a multiple of 32.
This should be used in conjunction with encode_topic_preimage
to
construct the preimage of a complex topic.
Sourcefn encode_topic_preimage(rust: &Self::RustType, out: &mut Vec<u8>)
fn encode_topic_preimage(rust: &Self::RustType, out: &mut Vec<u8>)
Encodes this type as preimage bytes which are then hashed in
complex types’ encode_topic
.
See the Solidity ABI spec for more details.
Sourcefn encode_topic(rust: &Self::RustType) -> WordToken
fn encode_topic(rust: &Self::RustType) -> WordToken
Indexed event parameter encoding.
Note that this is different from encode_topic_preimage
and
SolType::abi_encode
. See the Solidity ABI spec for more
details.
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.