Struct rocket_basicauth::BasicAuth [−][src]
Expand description
A high-level basic access authentication
request guard implementation, containing the username
and password
used for
authentication
Example
#[macro_use] extern crate rocket;
use rocket_basicauth::BasicAuth;
/// Hello route with `auth` request guard, containing a `username` and `password`
#[get("/hello/<age>")]
fn hello(auth: BasicAuth, age: u8) -> String {
format!("Hello, {} year old named {}!", age, auth.username)
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![hello])
}
Fields
username: String
Required username
password: String
Required password
Implementations
Trait Implementations
type Error = BasicAuthError
type Error = BasicAuthError
The associated error to be returned if derivation fails.
Auto Trait Implementations
impl RefUnwindSafe for BasicAuth
impl UnwindSafe for BasicAuth
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.