[][src]Struct elefren::scopes::Scopes

pub struct Scopes { /* fields omitted */ }

Represents a set of OAuth scopes

Example

use elefren::prelude::*;

let read = Scopes::read_all();
let write = Scopes::write_all();
let follow = Scopes::follow();
let all = read | write | follow;

Methods

impl Scopes[src]

pub fn all() -> Scopes[src]

Represents all available oauth scopes: "read write follow push"

use elefren::scopes::Scopes;

let scope = Scopes::all();
assert_eq!(&format!("{}", scope), "read write follow push");

pub fn read_all() -> Scopes[src]

Represents the full "read" scope

use elefren::scopes::Scopes;

let scope = Scopes::read_all();
assert_eq!(&format!("{}", scope), "read");

pub fn read(subscope: Read) -> Scopes[src]

Represents a specific "read:___" scope

use elefren::scopes::{Read, Scopes};

let scope = Scopes::read(Read::Accounts);
assert_eq!(&format!("{}", scope), "read:accounts");

pub fn write_all() -> Scopes[src]

Represents the full "write" scope

use elefren::scopes::Scopes;

let scope = Scopes::write_all();
assert_eq!(&format!("{}", scope), "write");

pub fn write(subscope: Write) -> Scopes[src]

Represents a specific "write:___" scope

use elefren::scopes::{Scopes, Write};

let scope = Scopes::write(Write::Accounts);
assert_eq!(&format!("{}", scope), "write:accounts");

pub fn follow() -> Scopes[src]

Represents the "follow" scope

use elefren::scopes::Scopes;

let scope = Scopes::follow();
assert_eq!(&format!("{}", scope), "follow");

pub fn push() -> Scopes[src]

Represents the full "push" scope

use elefren::scopes::Scopes;

let scope = Scopes::push();
assert_eq!(&format!("{}", scope), "push");

pub fn and(self, other: Scopes) -> Scopes[src]

Combines 2 scopes together

Example

use elefren::prelude::*;

let read = Scopes::read_all();
let write = Scopes::write_all();
let read_write = read.and(write);

Trait Implementations

impl PartialEq<Scopes> for Scopes[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Default for Scopes[src]

impl Clone for Scopes[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Display for Scopes[src]

impl Debug for Scopes[src]

impl BitOr<Scopes> for Scopes[src]

type Output = Scopes

The resulting type after applying the | operator.

impl FromStr for Scopes[src]

type Err = Error

The associated error which can be returned from parsing.

impl Serialize for Scopes[src]

Auto Trait Implementations

impl Send for Scopes

impl Sync for Scopes

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<'a, T> TryFrom<&'a str> for T where
    T: FromStr
[src]

type Err = <T as FromStr>::Err

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Err = <U as TryFrom<T>>::Err