rust_mqtt/config/client.rs
1use crate::{config::SessionExpiryInterval, types::VarByteInt};
2
3/// Configuration of the client which must be upheld by the server.
4#[derive(Debug, Clone, Copy)]
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
6pub struct Config {
7 /// The session expiry interval requested by the client.
8 /// This field is used to determine whether a non-zero session expiry interval
9 /// can be used when disconnecting.
10 /// This value is configured when calling [`crate::client::Client::connect`]
11 /// from the value in [`crate::client::options::ConnectOptions`]
12 pub session_expiry_interval: SessionExpiryInterval,
13
14 /// The maximum packet size the client is willing to accept transformed into the
15 /// maximum value of the remaining length that is therefore accepted.
16 /// This value is configured when calling [`crate::client::Client::connect`]
17 /// from the value in [`crate::client::options::ConnectOptions`]
18 pub maximum_accepted_remaining_length: u32,
19 // receive_maximum
20 // topic_alias_maximum
21 // request_response_information this requests a response_information property in the CONNACK
22 // request_problem_information indicates to the server that it may include reason strings and user properties
23}
24
25impl Default for Config {
26 fn default() -> Self {
27 Self {
28 session_expiry_interval: SessionExpiryInterval::default(),
29 maximum_accepted_remaining_length: VarByteInt::MAX_ENCODABLE,
30 }
31 }
32}