Struct tmi::client::Credentials
source · pub struct Credentials {
pub login: String,
pub token: Option<String>,
}
Expand description
Credentials used to authenticate to Twitch IRC.
The Default
impl uses Credentials::anon
.
Fields§
§login: String
§token: Option<String>
Implementations§
source§impl Credentials
impl Credentials
sourcepub fn new(login: impl ToString, token: impl ToString) -> Self
pub fn new(login: impl ToString, token: impl ToString) -> Self
Credentials using an OAuth token.
token
should be a User Access Token.
You can generate one by following the instructions on Authorization Code Grant Flow.
Make sure the token is valid before attempting to use it, and refresh it or generate a new one if it expires.
twitch_oauth2 can help automate most of this.
sourcepub fn anon() -> Self
pub fn anon() -> Self
An anonymous login.
Twitch allows logging in using any username in the form justinfan?????
where ?
is any digit. For example, justinfan11824
is a valid username.
If you login anonymously, you won’t be able to send messages, but you will still be able to read them, including all the usual tags, membership commands, etc.
pub fn is_anon(&self) -> bool
pub fn login(&self) -> &str
pub fn token(&self) -> Option<&str>
Trait Implementations§
source§impl Clone for Credentials
impl Clone for Credentials
source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Credentials
impl Debug for Credentials
Auto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnwindSafe for Credentials
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