pub struct Credentials {
    pub user_id: String,
    pub password: String,
}
Expand description

A struct to represent the user_id and password fields from an Authorization Basic header value

Fields

user_id: Stringpassword: String

Implementations

Create a new Credentials instance this is equivalent to writing:

use http_auth_basic::Credentials;

let credentials = Credentials {
    user_id: String::from("Foo"),
    password: String::from("Bar"),
};

Creates a Credentials instance from a base64 String which must encode user credentials as username:password

Encode a Credentials instance into a base64 String

Creates a Credentials instance from an HTTP Authorization header which schema is a valid Basic HTTP Authorization Schema.

Creates a HTTP Authorization header value for the basic schema from the Credentials instance

Trait Implementations

Formats the value using the given formatter. Read more

Creates a Credentials instance from either a base64 &str which must encode user credentials as username:password or an HTTP Authorization header which schema is a valid Basic HTTP Authorization Schema.

The associated error which can be returned from parsing.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

Calls U::from(self).

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

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.