Struct imap_types::auth::AuthMechanism
source · pub struct AuthMechanism<'a>(_);
Expand description
Authentication mechanism.
It’s recommended to use the pre-defined constants, such as, AuthMechanism::PLAIN
. Still, you
can also (try to) construct an authentication mechanism from a value.
use imap_types::{auth::AuthMechanism, core::Atom};
assert_eq!(AuthMechanism::PLAIN, AuthMechanism::try_from("plain")?);
assert_eq!(
AuthMechanism::PLAIN,
AuthMechanism::try_from(b"PLAIN".as_ref())?,
);
assert_eq!(
AuthMechanism::PLAIN,
AuthMechanism::from(Atom::try_from("pLAiN")?)
);
let mechanism = AuthMechanism::try_from(b"login".as_ref())?;
match mechanism {
AuthMechanism::PLAIN => {}
AuthMechanism::LOGIN => {}
_ => {}
}
Implementations§
source§impl<'a> AuthMechanism<'a>
impl<'a> AuthMechanism<'a>
sourcepub const PLAIN: AuthMechanism<'static> = _
pub const PLAIN: AuthMechanism<'static> = _
The PLAIN SASL mechanism.
AUTH=PLAIN
base64(b"<authenticate-id>\x00<authorize-id>\x00<password>")
Reference(s):
- RFC4616: The PLAIN Simple Authentication and Security Layer (SASL) Mechanism
sourcepub const LOGIN: AuthMechanism<'static> = _
pub const LOGIN: AuthMechanism<'static> = _
The (non-standardized and slow) LOGIN SASL mechanism.
AUTH=LOGIN
base64(b"<username>")
base64(b"<password>")
Reference(s):
- draft-murchison-sasl-login-00: The LOGIN SASL Mechanism
sourcepub const XOAUTH2: AuthMechanism<'static> = _
pub const XOAUTH2: AuthMechanism<'static> = _
Google’s OAuth 2.0 mechanism.
AUTH=XOAUTH2
base64(b"user=<user>\x01auth=Bearer <token>\x01\x01")
Reference(s):
Trait Implementations§
source§impl<'a> Arbitrary<'a> for AuthMechanism<'a>
impl<'a> Arbitrary<'a> for AuthMechanism<'a>
source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moresource§impl<'a> Clone for AuthMechanism<'a>
impl<'a> Clone for AuthMechanism<'a>
source§fn clone(&self) -> AuthMechanism<'a>
fn clone(&self) -> AuthMechanism<'a>
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<'a> Debug for AuthMechanism<'a>
impl<'a> Debug for AuthMechanism<'a>
source§impl<'de, 'a> Deserialize<'de> for AuthMechanism<'a>
impl<'de, 'a> Deserialize<'de> for AuthMechanism<'a>
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<'a> Display for AuthMechanism<'a>
impl<'a> Display for AuthMechanism<'a>
source§impl<'a> From<Atom<'a>> for AuthMechanism<'a>
impl<'a> From<Atom<'a>> for AuthMechanism<'a>
source§impl<'a> Hash for AuthMechanism<'a>
impl<'a> Hash for AuthMechanism<'a>
source§impl<'a> IntoBoundedStatic for AuthMechanism<'a>
impl<'a> IntoBoundedStatic for AuthMechanism<'a>
§type Static = AuthMechanism<'static>
type Static = AuthMechanism<'static>
The target type is bounded by the
'static
lifetime.source§fn into_static(self) -> Self::Static
fn into_static(self) -> Self::Static
Convert an owned
T
into an owned T
such that T: 'static
.source§impl<'a> PartialEq<AuthMechanism<'a>> for AuthMechanism<'a>
impl<'a> PartialEq<AuthMechanism<'a>> for AuthMechanism<'a>
source§fn eq(&self, other: &AuthMechanism<'a>) -> bool
fn eq(&self, other: &AuthMechanism<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a> Serialize for AuthMechanism<'a>
impl<'a> Serialize for AuthMechanism<'a>
source§impl<'a> ToBoundedStatic for AuthMechanism<'a>
impl<'a> ToBoundedStatic for AuthMechanism<'a>
source§impl<'a> TryFrom<&'a [u8]> for AuthMechanism<'a>
impl<'a> TryFrom<&'a [u8]> for AuthMechanism<'a>
source§impl<'a> TryFrom<&'a str> for AuthMechanism<'a>
impl<'a> TryFrom<&'a str> for AuthMechanism<'a>
source§impl<'a> TryFrom<String> for AuthMechanism<'a>
impl<'a> TryFrom<String> for AuthMechanism<'a>
impl<'a> Eq for AuthMechanism<'a>
impl<'a> StructuralEq for AuthMechanism<'a>
impl<'a> StructuralPartialEq for AuthMechanism<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for AuthMechanism<'a>
impl<'a> Send for AuthMechanism<'a>
impl<'a> Sync for AuthMechanism<'a>
impl<'a> Unpin for AuthMechanism<'a>
impl<'a> UnwindSafe for AuthMechanism<'a>
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