pub struct Scopes { /* private fields */ }Expand description
Represents a set of OAuth scopes
// Example
use mastodon_async::prelude::*;
let read = Scopes::read_all();
let write = Scopes::write_all();
let follow = Scopes::follow();
let all = read | write | follow;Implementations§
Source§impl Scopes
impl Scopes
Sourcepub fn all() -> Scopes
pub fn all() -> Scopes
Represents all available oauth scopes: “read write follow push”
use mastodon_async::scopes::Scopes;
let scope = Scopes::all();
assert_eq!(&format!("{}", scope), "read write follow push");Sourcepub fn read_all() -> Scopes
pub fn read_all() -> Scopes
Represents the full “read” scope
use mastodon_async::scopes::Scopes;
let scope = Scopes::read_all();
assert_eq!(&format!("{}", scope), "read");Sourcepub fn read(subscope: Read) -> Scopes
pub fn read(subscope: Read) -> Scopes
Represents a specific “read:___” scope
use mastodon_async::scopes::{Read, Scopes};
let scope = Scopes::read(Read::Accounts);
assert_eq!(&format!("{}", scope), "read:accounts");Sourcepub fn write_all() -> Scopes
pub fn write_all() -> Scopes
Represents the full “write” scope
use mastodon_async::scopes::Scopes;
let scope = Scopes::write_all();
assert_eq!(&format!("{}", scope), "write");Sourcepub fn write(subscope: Write) -> Scopes
pub fn write(subscope: Write) -> Scopes
Represents a specific “write:___” scope
use mastodon_async::scopes::{Scopes, Write};
let scope = Scopes::write(Write::Accounts);
assert_eq!(&format!("{}", scope), "write:accounts");Sourcepub fn follow() -> Scopes
pub fn follow() -> Scopes
Represents the “follow” scope
use mastodon_async::scopes::Scopes;
let scope = Scopes::follow();
assert_eq!(&format!("{}", scope), "follow");Trait Implementations§
Source§impl<'de> Deserialize<'de> for Scopes
impl<'de> Deserialize<'de> for Scopes
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Scopes
impl RefUnwindSafe for Scopes
impl Send for Scopes
impl Sync for Scopes
impl Unpin for Scopes
impl UnwindSafe for Scopes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more