pub trait Event: Sized {
const NAME: &'static str;
// Required methods
fn match_log(log: &Log) -> bool;
fn decode(log: &Log) -> Result<Self, String>;
// Provided method
fn match_and_decode(log: impl AsRef<Log>) -> Option<Self> { ... }
}
Required Associated Constants§
Required Methods§
Provided Methods§
Sourcefn match_and_decode(log: impl AsRef<Log>) -> Option<Self>
fn match_and_decode(log: impl AsRef<Log>) -> Option<Self>
Attempts to match and decode the log.
If Self::match_log(log)
is false
, returns None
.
If it matches, but decoding fails, logs the decoding error and returns None
.
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.