Trait cometd_client::types::access_token::AccessToken
source · pub trait AccessToken: Debug {
fn get_authorization_header<'a>(&'a self) -> &[(&'static str, Box<str>)];
}Expand description
Trait which can be used for implementing custom access token.
Example:
#[derive(Debug)]
struct SuperToken([(&'static str, Box<str>); 2]);
impl SuperToken {
pub fn new() -> Self {
Self([("super-name", "Jindřich".into()), ("super-city", "Skalica".into())])
}
}
impl AccessToken for SuperToken {
fn get_authorization_header<'a>(&'a self) -> &[(&'static str, Box<str>)] {
&self.0
}
}Required Methods§
Return reference to array of pairs (<HeaderName>, <HeaderValue>).