Struct pagerduty::AuthToken [] [src]

pub struct AuthToken<'a>(_);

A token used to authorize requests to PagerDuty.

The AuthToken is expected to be created with a String or &str passed to AuthToken::new. Since AuthToken uses a Cow internally, no extra allocations occur.

Example

let s = String::from("token");
// Only valid as long as the string slice is valid
let ref_token = AuthToken::new(&s[..]);

// Owned version may be desired in some cases
let owned_token = AuthToken::new(String::from("token"));

Methods

impl<'a> AuthToken<'a>

fn new<T>(raw_token: T) -> AuthToken<'a> where T: Into<Cow<'a, str>>

fn to_header(&self) -> Authorization<String>