pub struct RateLimitListener<State> { /* private fields */ }Expand description
TCP listener which accepts only a limited number of connections at a time.
This listener is based on tide::listener::TcpListener and should match the semantics of that
listener in every way, accept that when there are more simultaneous outstanding requests than
the configured limit, excess requests will fail immediately with error code 429 (Too Many
Requests).
Implementations§
Trait Implementations§
Source§impl<State> Debug for RateLimitListener<State>
impl<State> Debug for RateLimitListener<State>
Source§impl<State> Display for RateLimitListener<State>
impl<State> Display for RateLimitListener<State>
Source§impl<State> Listener<State> for RateLimitListener<State>
impl<State> Listener<State> for RateLimitListener<State>
Source§fn bind<'life0, 'async_trait>(
&'life0 mut self,
app: Server<State>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn bind<'life0, 'async_trait>(
&'life0 mut self,
app: Server<State>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Bind the listener. This starts the listening process by opening the
necessary network ports, but not yet accepting incoming connections. This
method must be called before
accept.Source§fn accept<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn accept<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start accepting incoming connections. This method must be called only
after
bind has succeeded.Source§fn info(&self) -> Vec<ListenInfo>
fn info(&self) -> Vec<ListenInfo>
Expose information about the connection. This should always return valid
data after
bind has succeeded.Source§impl<State> ToListener<State> for RateLimitListener<State>
impl<State> ToListener<State> for RateLimitListener<State>
Source§type Listener = RateLimitListener<State>
type Listener = RateLimitListener<State>
What listener are we converting into?
Source§fn to_listener(self) -> Result<Self::Listener>
fn to_listener(self) -> Result<Self::Listener>
Transform self into a
Listener. Unless self is
already bound/connected to the underlying io, converting to a
listener does not initiate a connection. An Err return
indicates an unsuccessful conversion to a listener, not an
unsuccessful bind attempt.Auto Trait Implementations§
impl<State> Freeze for RateLimitListener<State>where
State: Freeze,
impl<State> !RefUnwindSafe for RateLimitListener<State>
impl<State> Send for RateLimitListener<State>where
State: Send,
impl<State> Sync for RateLimitListener<State>where
State: Sync,
impl<State> Unpin for RateLimitListener<State>where
State: Unpin,
impl<State> !UnwindSafe for RateLimitListener<State>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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> 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