pub struct Key {
pub name: String,
pub value: String,
}Expand description
An API Key used to authenticate with the REST API using HTTP Basic Auth.
Fields§
§name: String§value: StringImplementations§
Source§impl Key
impl Key
Sourcepub fn sign(&self, params: &TokenParams) -> Result<TokenRequest>
pub fn sign(&self, params: &TokenParams) -> Result<TokenRequest>
Use the API key to sign the given TokenParams, returning a signed TokenRequest which can be exchanged for a token.
§Example
use std::convert::TryFrom;
use ably::auth;
let key = auth::Key::try_from("ABC123.DEF456:XXXXXXXXXXXX").unwrap();
let mut params = auth::TokenParams::default();
params.client_id = Some("test@example.com".to_string());
let req = key.sign(¶ms).unwrap();Trait Implementations§
Source§impl<'de> Deserialize<'de> for Key
impl<'de> Deserialize<'de> for Key
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl TryFrom<&str> for Key
impl TryFrom<&str> for Key
impl Eq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.