pub struct Auth { /* private fields */ }Expand description
Represents an MQTT AUTH packet.
The Auth packet is used in the MQTT v5 protocol for enhanced authentication and
re-authentication.
It includes a reason code and optional properties.
§Example
use bytes::Bytes;
use mqute_codec::protocol::v5::{Auth, AuthProperties, ReasonCode};
let properties = AuthProperties {
auth_method: Some("method".to_string()),
auth_data: Some(Bytes::from("data")),
reason_string: Some("reason".to_string()),
user_properties: vec![("key".to_string(), "value".to_string())],
};
let auth = Auth::new(ReasonCode::ContinueAuthentication, Some(properties));
assert_eq!(auth.code(), ReasonCode::ContinueAuthentication);Implementations§
Source§impl Auth
impl Auth
Sourcepub fn new(code: ReasonCode, properties: Option<AuthProperties>) -> Self
pub fn new(code: ReasonCode, properties: Option<AuthProperties>) -> Self
Creates a new Auth packet.
Sourcepub fn code(&self) -> ReasonCode
pub fn code(&self) -> ReasonCode
Returns the reason code of the Auth packet.
Sourcepub fn properties(&self) -> Option<AuthProperties>
pub fn properties(&self) -> Option<AuthProperties>
Returns the properties of the Auth packet.
Trait Implementations§
impl Auth for Auth
impl Eq for Auth
impl StructuralPartialEq for Auth
Auto Trait Implementations§
impl !Freeze for Auth
impl RefUnwindSafe for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin for Auth
impl UnwindSafe for Auth
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<T> Encoded for Twhere
T: Encode,
impl<T> Encoded for Twhere
T: Encode,
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Calculates the total encoded length of the packet. Read more