pub trait Eventable:
Unpin
+ Send
+ Sync
+ 'static {
// Required method
fn data(&self) -> Option<&str>;
// Provided methods
fn comment(&self) -> Option<&str> { ... }
fn event_type(&self) -> Option<&str> { ... }
fn id(&self) -> Option<&str> { ... }
fn retry(&self) -> Option<Duration> { ... }
}Expand description
Required Methods§
Provided Methods§
Sourcefn comment(&self) -> Option<&str>
fn comment(&self) -> Option<&str>
return a comment to send alongside this event, optionally
Comments are ignored by clients. They are chiefly used as a heartbeat, sent periodically so that an idle event stream is still producing traffic.
Sourcefn event_type(&self) -> Option<&str>
fn event_type(&self) -> Option<&str>
return the event type, optionally
Sourcefn retry(&self) -> Option<Duration>
fn retry(&self) -> Option<Duration>
return a reconnection time to request of the client, optionally
Sent as a retry: field in milliseconds, truncated. Clients that reconnect on their own
— such as the browser EventSource — wait this long before doing so. Whether and how it
is honored is entirely up to the client.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".