pub struct Scopes { /* private fields */ }
Expand description

OAuth2 flow scopes object defines required permissions for oauh flow.

Scopes must be given to oauth2 flow but depending on need one of few initialization methods could be used.

Examples

Create empty map of scopes.

let scopes = Scopes::new();

Create Scopes holding one scope.

let scopes = Scopes::one("edit:item", "edit pets");

Create map of scopes from iterator.

let scopes = Scopes::from_iter([
    ("edit:items", "edit my items"),
    ("read:items", "read my items")
]);

Implementations

Construct new Scopes with empty map of scopes. This is useful if oauth flow does not need any permission scopes.

Examples

Create empty map of scopes.

let scopes = Scopes::new();

Construct new Scopes with hodling one scope.

  • scope Is be the permission required.
  • description Short description about the permission.
Examples

Create map of scopes with one scope item.

let scopes = Scopes::one("edit:item", "edit items");

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Creates a value from an iterator. Read more

Serialize this value into the given Serde serializer. 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.

Calls U::from(self).

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

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.