pub struct SseSender { /* private fields */ }Expand description
Sends events to one streaming SSE response; clone it to send from several places. The stream ends when the last clone is dropped.
Implementations§
Source§impl SseSender
impl SseSender
Sourcepub fn send(&self, event: SseEvent) -> Result<(), SseClosed>
pub fn send(&self, event: SseEvent) -> Result<(), SseClosed>
Send event, waiting while the buffer is full (a slow client slows
the sender down rather than growing memory). Blocks the thread: in
async code use Self::send_async or Self::try_send.
Sourcepub fn try_send(&self, event: SseEvent) -> Result<bool, SseClosed>
pub fn try_send(&self, event: SseEvent) -> Result<bool, SseClosed>
Send event if there’s room: Ok(false) when the buffer is full and
the event was dropped.
Sourcepub async fn send_async(&self, event: SseEvent) -> Result<(), SseClosed>
Available on crate feature http2 only.
pub async fn send_async(&self, event: SseEvent) -> Result<(), SseClosed>
http2 only.Self::send without blocking the async runtime: waits for room
with short sleeps.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SseSender
impl RefUnwindSafe for SseSender
impl Send for SseSender
impl Sync for SseSender
impl Unpin for SseSender
impl UnsafeUnpin for SseSender
impl UnwindSafe for SseSender
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more