Struct Builder

Source
pub struct Builder {
Show 33 fields pub name: String, pub laddr: SocketAddr, pub backlog: i32, pub nodelay: bool, pub reuseaddr: Option<bool>, pub reuseport: Option<bool>, pub max_connections: usize, pub max_handshaking_limit: usize, pub max_packet_size: u32, pub allow_anonymous: bool, pub min_keepalive: u16, pub max_keepalive: u16, pub allow_zero_keepalive: bool, pub keepalive_backoff: f32, pub max_inflight: NonZeroU16, pub handshake_timeout: Duration, pub send_timeout: Duration, pub max_mqueue_len: usize, pub mqueue_rate_limit: (NonZeroU32, Duration), pub max_clientid_len: usize, pub max_qos_allowed: QoS, pub max_topic_levels: usize, pub session_expiry_interval: Duration, pub message_retry_interval: Duration, pub message_expiry_interval: Duration, pub max_subscriptions: usize, pub shared_subscription: bool, pub max_topic_aliases: u16, pub limit_subscription: bool, pub delayed_publish: bool, pub tls_cross_certificate: bool, pub tls_cert: Option<String>, pub tls_key: Option<String>,
}
Expand description

Server configuration and listener management Configuration builder for MQTT server instances

Fields§

§name: String

Server identifier for logging and monitoring

§laddr: SocketAddr

Network address to listen on

§backlog: i32

Maximum number of pending connections in the accept queue

§nodelay: bool

Enable TCP_NODELAY option for lower latency

§reuseaddr: Option<bool>

Set SO_REUSEADDR socket option

§reuseport: Option<bool>

Set SO_REUSEPORT socket option

§max_connections: usize

Maximum concurrent active connections

§max_handshaking_limit: usize

Maximum simultaneous handshakes during connection setup

§max_packet_size: u32

Maximum allowed MQTT packet size in bytes (0 = unlimited)

§allow_anonymous: bool

Allow unauthenticated client connections

§min_keepalive: u16

Minimum acceptable keepalive value in seconds

§max_keepalive: u16

Maximum acceptable keepalive value in seconds

§allow_zero_keepalive: bool

Allow clients to disable keepalive mechanism

§keepalive_backoff: f32

Multiplier for calculating actual keepalive timeout

§max_inflight: NonZeroU16

Window size for unacknowledged QoS 1/2 messages

§handshake_timeout: Duration

Timeout for completing connection handshake

§send_timeout: Duration

Network I/O timeout for sending operations

§max_mqueue_len: usize

Maximum messages queued per client

§mqueue_rate_limit: (NonZeroU32, Duration)

Rate limiting for message delivery (messages per duration)

§max_clientid_len: usize

Maximum length of client identifiers

§max_qos_allowed: QoS

Highest QoS level permitted for publishing

§max_topic_levels: usize

Maximum depth for topic hierarchy (0 = unlimited)

§session_expiry_interval: Duration

Duration before inactive sessions expire

§message_retry_interval: Duration

Retry interval for unacknowledged messages

§message_expiry_interval: Duration

Time-to-live for undelivered messages

§max_subscriptions: usize

Maximum subscriptions per client (0 = unlimited)

§shared_subscription: bool

Enable shared subscription support

§max_topic_aliases: u16

Maximum topic aliases (MQTTv5 feature)

§limit_subscription: bool

Enable subscription count limiting

§delayed_publish: bool

Enable future-dated message publishing

§tls_cross_certificate: bool

Enable mutual TLS authentication

§tls_cert: Option<String>

Path to TLS certificate chain

§tls_key: Option<String>

Path to TLS private key

Implementations§

Source§

impl Builder

§Examples

use std::net::SocketAddr;
use rmqtt_net::Builder;

let builder = Builder::new()
    .name("EdgeBroker")
    .laddr("127.0.0.1:1883".parse().unwrap())
    .max_connections(10_000);
Source

pub fn new() -> Builder

Creates a new builder with default configuration values

Source

pub fn name<N: Into<String>>(self, name: N) -> Self

Sets the server name identifier

Source

pub fn laddr(self, laddr: SocketAddr) -> Self

Configures the network listen address

Source

pub fn backlog(self, backlog: i32) -> Self

Sets the TCP backlog size

Source

pub fn nodelay(self, nodelay: bool) -> Self

Enables/disables TCP_NODELAY option

Source

pub fn reuseaddr(self, reuseaddr: Option<bool>) -> Self

Configures SO_REUSEADDR socket option

Source

pub fn reuseport(self, reuseport: Option<bool>) -> Self

Configures SO_REUSEPORT socket option

Source

pub fn max_connections(self, max_connections: usize) -> Self

Sets maximum concurrent connections

Source

pub fn max_handshaking_limit(self, max_handshaking_limit: usize) -> Self

Sets maximum concurrent handshakes

Source

pub fn max_packet_size(self, max_packet_size: u32) -> Self

Configures maximum MQTT packet size

Source

pub fn allow_anonymous(self, allow_anonymous: bool) -> Self

Enables anonymous client access

Source

pub fn min_keepalive(self, min_keepalive: u16) -> Self

Sets minimum acceptable keepalive value

Source

pub fn max_keepalive(self, max_keepalive: u16) -> Self

Sets maximum acceptable keepalive value

Source

pub fn allow_zero_keepalive(self, allow_zero_keepalive: bool) -> Self

Allows clients to disable keepalive

Source

pub fn keepalive_backoff(self, keepalive_backoff: f32) -> Self

Configures keepalive backoff multiplier

Source

pub fn max_inflight(self, max_inflight: NonZeroU16) -> Self

Sets inflight message window size

Source

pub fn handshake_timeout(self, handshake_timeout: Duration) -> Self

Configures handshake timeout duration

Source

pub fn send_timeout(self, send_timeout: Duration) -> Self

Sets network send timeout duration

Source

pub fn max_mqueue_len(self, max_mqueue_len: usize) -> Self

Configures maximum message queue length

Source

pub fn mqueue_rate_limit( self, rate_limit: NonZeroU32, duration: Duration, ) -> Self

Sets message rate limiting parameters

Source

pub fn max_clientid_len(self, max_clientid_len: usize) -> Self

Sets maximum client ID length

Source

pub fn max_qos_allowed(self, max_qos_allowed: QoS) -> Self

Configures maximum allowed QoS level

Source

pub fn max_topic_levels(self, max_topic_levels: usize) -> Self

Sets maximum topic hierarchy depth

Source

pub fn session_expiry_interval(self, session_expiry_interval: Duration) -> Self

Configures session expiration interval

Source

pub fn message_retry_interval(self, message_retry_interval: Duration) -> Self

Sets message retry interval for QoS 1/2

Source

pub fn message_expiry_interval(self, message_expiry_interval: Duration) -> Self

Configures message expiration time

Source

pub fn max_subscriptions(self, max_subscriptions: usize) -> Self

Sets maximum subscriptions per client

Source

pub fn shared_subscription(self, shared_subscription: bool) -> Self

Enables shared subscription support

Source

pub fn max_topic_aliases(self, max_topic_aliases: u16) -> Self

Configures maximum topic aliases (MQTTv5)

Source

pub fn limit_subscription(self, limit_subscription: bool) -> Self

Enables subscription count limiting

Source

pub fn delayed_publish(self, delayed_publish: bool) -> Self

Enables delayed message publishing

Source

pub fn tls_cross_certificate(self, cross_certificate: bool) -> Self

Enables mutual TLS authentication

Source

pub fn tls_cert<N: Into<String>>(self, tls_cert: Option<N>) -> Self

Sets path to TLS certificate chain

Source

pub fn tls_key<N: Into<String>>(self, tls_key: Option<N>) -> Self

Sets path to TLS private key

Source

pub fn bind(self) -> Result<Listener>

Binds the server to the configured address

Trait Implementations§

Source§

impl Clone for Builder

Source§

fn clone(&self) -> Builder

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Builder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Builder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V