[−][src]Struct oauth_credentials::Token
A set of OAuth client credentials and token/temporary credentials used for authorizing requests on behalf of a resource owner.
Fields
client: Credentials<C>
Client credentials.
token: Credentials<T>
Token/temporary credentials.
Implementations
impl<C: AsRef<str>, T: AsRef<str>> Token<C, T>
[src]
pub fn new(client: Credentials<C>, token: Credentials<T>) -> Self
[src]
Creates a new Token
.
pub fn from_parts(
client_identifier: C,
client_secret: C,
token: T,
token_secret: T
) -> Self
[src]
client_identifier: C,
client_secret: C,
token: T,
token_secret: T
) -> Self
Creates a new Token
out of identifier and shared-secret strings.
pub fn client(&self) -> Credentials<&str>
[src]
Returns the client credentials part.
pub fn token(&self) -> Credentials<&str>
[src]
Returns the token credentials part.
pub fn as_ref(&self) -> Token<&str>
[src]
Converts from &Token<C, T>
to Token<&str, &str>
.
impl<C, T> Token<C, T>
[src]
pub fn map_client<C2, F>(self, f: F) -> Token<C2, T> where
F: FnMut(C) -> C2,
C2: AsRef<str>,
[src]
F: FnMut(C) -> C2,
C2: AsRef<str>,
Maps a Token<C, T>
to Token<C2, T>
by applying a function to a contained client
value, leaving a token
value untouched.
Example
async fn get_token<C: AsRef<str>, T: AsRef<str>>(temporary: Token<C, T>) -> Token<C, String> { // ... } let token: Token<&str, String> = get_token(temporary.as_ref()).await; let owned: Token = token.map_client(String::from);
pub fn map_token<T2, F>(self, f: F) -> Token<C, T2> where
F: FnMut(T) -> T2,
T2: AsRef<str>,
[src]
F: FnMut(T) -> T2,
T2: AsRef<str>,
Maps a Token<C, T>
to Token<C, T2>
by applying a function to a contained token
value, leaving a client
value untouched.
Example
async fn get_token<C: AsRef<str>, T: AsRef<str>>(temporary: Token<C, T>) -> Token<C, String> { // ... } let token: Token<Box<str>, String> = get_token(temporary).await; let boxed: Token<Box<str>> = token.map_token(Into::into);
impl<T> Token<T>
[src]
pub fn map<U, F>(self, mut f: F) -> Token<U> where
F: FnMut(T) -> U,
U: AsRef<str>,
[src]
F: FnMut(T) -> U,
U: AsRef<str>,
Maps a Token<T, T>
to Token<U, U>
by applying a function to contained string values.
Example
async fn get_token() -> Token { // ... } let token: Token = get_token().await; let boxed: Token<Box<str>> = token.map(Into::into);
impl<'a, 'b> Token<&'a str, &'b str>
[src]
pub fn from_ref<C: AsRef<str>, T: AsRef<str>>(
client: &'a Credentials<C>,
token: &'b Credentials<T>
) -> Self
[src]
client: &'a Credentials<C>,
token: &'b Credentials<T>
) -> Self
Creates a new Token<&str, &str>
from a pair of &Credentials<_>
.
Trait Implementations
impl<C: Clone, T: Clone> Clone for Token<C, T>
[src]
impl<C: Copy, T: Copy> Copy for Token<C, T>
[src]
impl<C: Debug, T: Debug> Debug for Token<C, T>
[src]
impl<'a, C: AsRef<str>, T: AsRef<str>> From<&'a Token<C, T>> for Token<&'a str>
[src]
Auto Trait Implementations
impl<C, T> RefUnwindSafe for Token<C, T> where
C: RefUnwindSafe,
T: RefUnwindSafe,
[src]
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<C, T> Send for Token<C, T> where
C: Send,
T: Send,
[src]
C: Send,
T: Send,
impl<C, T> Sync for Token<C, T> where
C: Sync,
T: Sync,
[src]
C: Sync,
T: Sync,
impl<C, T> Unpin for Token<C, T> where
C: Unpin,
T: Unpin,
[src]
C: Unpin,
T: Unpin,
impl<C, T> UnwindSafe for Token<C, T> where
C: UnwindSafe,
T: UnwindSafe,
[src]
C: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,