Skip to main content

FramePayload

Trait FramePayload 

Source
pub trait FramePayload: Send + 'static {
    // Required method
    fn to_frame(&self, id: EventId) -> Result<SseEvent, SseError>;
}
Expand description

A payload an EventTail can put on the wire.

The one method, because it is the only question the ring asks. The alternative shape — a payload that is an SseEvent — was rejected because it would push the id out to every call site, and the id is the ring’s business, not the payload’s.

Required Methods§

Source

fn to_frame(&self, id: EventId) -> Result<SseEvent, SseError>

This payload as one frame, positioned at id.

§Errors

SseError::Unserialisable if the payload has no wire form. The payload is this server’s own data and the failure is this server’s fault, so a caller reports it as a 500.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FramePayload for Value

A JSON payload becomes a message event — unnamed, because Streamable HTTP does not name its frames and a name here would be a 2026-07-28 client’s problem to have an unexpected field.

Implementors§