pub trait FromEventData: Sized {
    type Err: Error;

    // Required method
    fn from_data<S: AsRef<[u8]>>(data: S) -> Result<Self, Self::Err>;

    // Provided method
    fn only_id() -> bool { ... }
}

Required Associated Types§

Required Methods§

source

fn from_data<S: AsRef<[u8]>>(data: S) -> Result<Self, Self::Err>

Provided Methods§

source

fn only_id() -> bool

only pass the event id to from_data

Implementations on Foreign Types§

source§

impl FromEventData for Vec<u8>

Get the event id

§

type Err = Error

source§

fn only_id() -> bool

source§

fn from_data<S: AsRef<[u8]>>(data: S) -> Result<Self, Self::Err>

source§

impl FromEventData for String

Get the json string

§

type Err = Error

source§

fn from_data<S: AsRef<[u8]>>(json: S) -> Result<Self, Self::Err>

Implementors§

source§

impl FromEventData for Event

Parse the json string to event object

§

type Err = Error