Struct trillium_sse::Event [−][src]
pub struct Event { /* fields omitted */ }
Expand description
Events are a concrete implementation of the Eventable
trait.
Implementations
builds a new Event
by default, this event has no event type. to set an event type,
use Event::with_type
or Event::set_type
chainable constructor to set the type on an event
let event = trillium_sse::Event::new("event data").with_type("userdata");
assert_eq!(event.event_type(), Some("userdata"));
assert_eq!(event.data(), "event data");
set the event type for this Event. The default is None.
let mut event = trillium_sse::Event::new("event data");
assert_eq!(event.event_type(), None);
event.set_type("userdata");
assert_eq!(event.event_type(), Some("userdata"));
returns this Event’s type as a str, if set
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Event
impl UnwindSafe for Event
Blanket Implementations
Mutably borrows from an owned value. Read more