Struct twitch_api_rs::auth::scopes::ScopeSet[][src]

pub struct ScopeSet { /* fields omitted */ }

Represents a set of scopes available with a specific bearer auth key

Implementations

impl ScopeSet[src]

pub fn new() -> Self[src]

Create a new empty set of scopes

pub fn get(&self, bit: usize) -> bool[src]

Get whether this type contains a single scope

pub fn set(&mut self, bit: usize, val: bool) -> bool[src]

Set a bit for a single scope, returns the old value

pub fn contains(&self, scope: &str) -> bool[src]

Returns true if the set contains the scope specified
Returns false if it does not or the scope does not exist

let mut scopes = ScopeSet::new();

scopes.set(2, true);

assert!(scopes.contains("bits:read"));

assert!(!scopes.contains("channel:edit:commercial"));

pub fn iter<'a>(&'a self) -> ScopesIter<'a>

Notable traits for ScopesIter<'a>

impl<'a> Iterator for ScopesIter<'a> type Item = &'static str;
[src]

Get an iterator over scopes idents iterator

pub fn ident_to(a: &usize) -> Option<&'static str>[src]

Identity function for converting between scope internal number and twitch token string

pub fn ident_from(b: &str) -> Option<&'static usize>[src]

Identity function for converting between scope internal number and twitch token string

Trait Implementations

impl Clone for ScopeSet[src]

impl Debug for ScopeSet[src]

impl<'a> FromIterator<&'a str> for ScopeSet[src]

impl<'a> IntoIterator for &'a ScopeSet[src]

type Item = &'static str

The type of the elements being iterated over.

type IntoIter = ScopesIter<'a>

Which kind of iterator are we turning this into?

Auto Trait Implementations

Blanket Implementations

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

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

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

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

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,