pub trait EventStreamFormatter {
// Required methods
fn content_type(&self) -> &'static str;
fn encode(&self, event: &Event) -> Result<Vec<u8>>;
}Expand description
Turns events into the bytes a transport puts on the wire.
Object-safe, so a server can pick a formatter once per connection and store
it as Box<dyn EventStreamFormatter>.
Required Methods§
Sourcefn content_type(&self) -> &'static str
fn content_type(&self) -> &'static str
The Content-Type to answer with.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".