pub struct Limits {
pub requests_per_minute: u32,
pub sign_ins_per_minute: u32,
pub body_bytes: usize,
pub characters: u32,
pub monsters: u32,
pub rules_texts: u32,
pub combats: u32,
pub plans: u32,
pub devices: u32,
pub events_per_combat: u32,
pub connections_per_combat: u32,
pub trust_proxy: bool,
/* private fields */
}Expand description
What a service allows; see the module’s description.
Fields§
§requests_per_minute: u32Requests per minute from one client address, to any route.
sign_ins_per_minute: u32Requests per minute from one client address to the routes that need no token: logging in, setting up a campaign, joining a pairing.
body_bytes: usizeThe largest request body accepted.
characters: u32What one campaign may keep.
monsters: u32Its own monsters, and its own spells and its own conditions (each).
rules_texts: u32§combats: u32§plans: u32§devices: u32§events_per_combat: u32§connections_per_combat: u32Devices watching one combat at once (per instance).
trust_proxy: boolWhether a request’s client is the last X-Forwarded-For address
(TRUST_PROXY=1); see the module’s description.
Implementations§
Source§impl Limits
impl Limits
Sourcepub fn from_env() -> Result<Self, String>
pub fn from_env() -> Result<Self, String>
The limits from the environment: on unless LIMITS=off, each
changed by LIMIT_<NAME>, and TRUST_PROXY.
Sourcepub fn room_for(
&self,
used: i64,
more: u32,
max: u32,
what: &str,
) -> Result<(), String>
pub fn room_for( &self, used: i64, more: u32, max: u32, what: &str, ) -> Result<(), String>
Whether a campaign that keeps used of something may add more,
given its limit max; if not, what to tell it.
Sourcepub fn with(&self, quotas: &Quotas) -> Limits
pub fn with(&self, quotas: &Quotas) -> Limits
These, with a campaign’s own quotas in place of the ones they set.
Sourcepub fn guard_sign_ins<S: Clone + Send + Sync + 'static>(
&self,
router: Router<S>,
) -> Router<S>
pub fn guard_sign_ins<S: Clone + Send + Sync + 'static>( &self, router: Router<S>, ) -> Router<S>
router (the routes that need no token) with the stricter limit on
signing in.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Limits
impl RefUnwindSafe for Limits
impl Send for Limits
impl Sync for Limits
impl Unpin for Limits
impl UnsafeUnpin for Limits
impl UnwindSafe for Limits
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read more§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read more