Trait Function

Source
pub trait Function: Sized {
    const NAME: &'static str;

    // Required methods
    fn match_call(log: &Call) -> bool;
    fn decode(log: &Call) -> Result<Self, String>;
    fn encode(&self) -> Vec<u8> ;

    // Provided method
    fn match_and_decode(call: impl AsRef<Call>) -> Option<Self> { ... }
}

Required Associated Constants§

Source

const NAME: &'static str

Required Methods§

Source

fn match_call(log: &Call) -> bool

Source

fn decode(log: &Call) -> Result<Self, String>

Source

fn encode(&self) -> Vec<u8>

Provided Methods§

Source

fn match_and_decode(call: impl AsRef<Call>) -> Option<Self>

Attempts to match and decode the call. If Self::match_call(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.

Implementors§