chromiumoxide::cdp

Trait CustomEvent

Source
pub trait CustomEvent:
    Any
    + DeserializeOwned
    + MethodType
    + Send
    + Sync {
    // Provided method
    fn from_json(event: Value) -> Result<Self, Error>
       where Self: Sized + 'static { ... }
}
Expand description

This trait allows for implementing custom events that are not covered by the chrome protocol definitions.

Every CustomEvent also requires an implementation of chromiumoxide_types::MethodType and it must be DeserializeOwned (#[derive(serde::Deserialize)]). This is necessary to identify match this type against the provided method identifier of a CdpEventMessage and to properly deserialize it from a serde_json::Value

Provided Methods§

Source

fn from_json(event: Value) -> Result<Self, Error>
where Self: Sized + 'static,

Used to convert the json event into in instance of this type

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§