pub struct Sse<S> { /* private fields */ }
Expand description
An SSE response
Implementations§
Source§impl<S> Sse<S>
impl<S> Sse<S>
Sourcepub fn new(stream: S) -> Sse<S>
pub fn new(stream: S) -> Sse<S>
Create a new Sse
response that will respond with the given stream of
Event
s.
See the module docs for more details.
Sourcepub fn keep_alive(self, keep_alive: KeepAlive) -> Sse<S>
pub fn keep_alive(self, keep_alive: KeepAlive) -> Sse<S>
Configure the interval between keep-alive messages.
Defaults to no keep-alive messages.
Trait Implementations§
Auto Trait Implementations§
impl<S> !Freeze for Sse<S>
impl<S> RefUnwindSafe for Sse<S>where
S: RefUnwindSafe,
impl<S> Send for Sse<S>where
S: Send,
impl<S> Sync for Sse<S>where
S: Sync,
impl<S> Unpin for Sse<S>where
S: Unpin,
impl<S> UnwindSafe for Sse<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, S, B> Handler<IntoResponseHandler, S, B> for T
impl<T, S, B> Handler<IntoResponseHandler, S, B> for T
Source§type Future = Ready<Response<UnsyncBoxBody<Bytes, Error>>>
type Future = Ready<Response<UnsyncBoxBody<Bytes, Error>>>
The type of future calling this handler returns.
Source§fn call(
self,
_req: Request<B>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S, B>>::Future
fn call( self, _req: Request<B>, _state: S, ) -> <T as Handler<IntoResponseHandler, S, B>>::Future
Call the handler with the given request.
Source§fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>where
L: Layer<HandlerService<Self, T, S, B>> + Clone,
<L as Layer<HandlerService<Self, T, S, B>>>::Service: Service<Request<NewReqBody>>,
fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>where
L: Layer<HandlerService<Self, T, S, B>> + Clone,
<L as Layer<HandlerService<Self, T, S, B>>>::Service: Service<Request<NewReqBody>>,
Apply a
tower::Layer
to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S, B>
fn with_state(self, state: S) -> HandlerService<Self, T, S, B>
Convert the handler into a
Service
by providing the stateSource§impl<H, T, B> HandlerWithoutStateExt<T, B> for H
impl<H, T, B> HandlerWithoutStateExt<T, B> for H
Source§fn into_service(self) -> HandlerService<H, T, (), B>
fn into_service(self) -> HandlerService<H, T, (), B>
Convert the handler into a
Service
and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, (), B>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, (), B>>
Convert the handler into a
MakeService
and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, (), B>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, (), B>, C>
Convert the handler into a
MakeService
which stores information
about the incoming connection and has no state. Read moreSource§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 more