Trait trillium_sse::Eventable

source ·
pub trait Eventable: Unpin + Send + Sync + 'static {
    // Required method
    fn data(&self) -> &str;

    // Provided methods
    fn event_type(&self) -> Option<&str> { ... }
    fn id(&self) -> Option<&str> { ... }
}
Expand description

A trait that allows any Unpin + Send + Sync type to act as an event.

For a concrete implementation of this trait, you can use Event, but it is also implemented for String and [&'static str].

Required Methods§

source

fn data(&self) -> &str

return the data for this event. non-optional.

Provided Methods§

source

fn event_type(&self) -> Option<&str>

return the event type, optionally

source

fn id(&self) -> Option<&str>

return a unique event id, optionally

Implementations on Foreign Types§

source§

impl Eventable for &'static str

source§

fn data(&self) -> &str

source§

impl Eventable for String

source§

fn data(&self) -> &str

Implementors§