pub trait EventSource {
// Required method
fn events(
self,
) -> impl Future<Output = Result<Pin<Box<impl Stream<Item = Result<Event, EventError>>>>, EventSourceError>> + Send;
}Required Methods§
Sourcefn events(
self,
) -> impl Future<Output = Result<Pin<Box<impl Stream<Item = Result<Event, EventError>>>>, EventSourceError>> + Send
fn events( self, ) -> impl Future<Output = Result<Pin<Box<impl Stream<Item = Result<Event, EventError>>>>, EventSourceError>> + Send
Converts the Response into a stream of Server-Sent Events.
Returns it as a faillable Stream of Events.
§Errors
Returns an EventSourceError if:
- The response status is not
200 OK - The
Content-Typeheader is missing or nottext/event-stream
The stream yields an EventError when error occure on event reading.
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.