Trait FromEventData

Source
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

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.

Implementations on Foreign Types§

Source§

impl FromEventData for String

Get the json string

Source§

type Err = Error

Source§

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

Source§

impl FromEventData for Vec<u8>

Get the event id

Source§

type Err = Error

Source§

fn only_id() -> bool

Source§

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

Implementors§

Source§

impl FromEventData for Event

Parse the json string to event object