Struct kvarn::extensions::RuleSet

source ·
pub struct RuleSet<R> { /* private fields */ }
Expand description

A set of rules applicable to certain paths. See the note at Self::empty on how paths are matched.

Implementations§

Check if the (cross-origin) request’s origin Uri is allowed by the CORS rules.

See CorsAllowList::check for info about the return types.

Check if the Request::headers and Request::uri is allowed with this ruleset.

This will not check for errors in access-control-request-headers.

Use this over Self::check_origin because this checks for same_origin requests.

See CorsAllowList::check for info about the return types.

Creates a new ruleset without any rules.

Adds rule to path.

To use this with Host::vary, use Self::add_mut, which this uses internally.

By default, path will only match requests with the exact path. This can be changed by appending * to the end of the path, which will then check if the request path start with path.

Same as Self::add but operating on a mutable reference.

Puts self in a Arc.

Useful for e.g. adding a Cors ruleset with Extensions::with_cors.

Gets the rule (if any) at uri_path.

For info about how this is matched, see Self::add.

Gets the Settings from the ruleset using the path of request.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more