pub struct Guard<'r> { /* private fields */ }
Expand description

A request guard to check CORS headers before a route is run. Will not execute the route if checks fail.

See the documentation at the crate root for usage information.

You should not wrap this in an Option or Result because the guard will let non-CORS requests through and will take over error handling in case of errors. In essence, this is just a wrapper around Response with a 'r borrowed lifetime so users don’t have to keep specifying the lifetimes in their routes

Implementations

Consumes the Guard and return a Responder that wraps a provided rocket:response::Responder with CORS headers

Merge a rocket::Response with this CORS Guard. This is usually used in the final step of a route to return a value for the route.

This will overwrite any existing CORS headers

Trait Implementations

The associated error to be returned if derivation fails.

Derives an instance of Self from the incoming request metadata. 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

Performs the conversion.

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

Performs the conversion.

Converts self into a collection.

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