Skip to main content

SseEventMeta

Trait SseEventMeta 

Source
pub trait SseEventMeta {
    // Required methods
    fn event_name(&self) -> &'static str;
    fn all_event_names() -> &'static [&'static str];
}
Expand description

Per-variant metadata for a Server-Sent Event enum.

Implemented automatically by the SseEvent derive; hand-written impls are supported but rare. The trait exposes two pieces of information:

  • Self::event_name — the event name emitted on the event: line of the SSE frame for a specific value. Defaults to the snake-case form of the variant name; overridable per variant via #[sse(name = "…")].
  • Self::all_event_names — the full set of event names the enum can produce, in declaration order. Surfaced for documentation/testing; not used on the hot path.

Required Methods§

Source

fn event_name(&self) -> &'static str

Return the SSE event name for the current variant.

Source

fn all_event_names() -> &'static [&'static str]

Return every event name this enum can produce, in variant declaration order.

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§