pub struct SubscriptionOptions {
pub retain_handling: RetainHandling,
pub retain_as_published: bool,
pub no_local: bool,
pub qos: QoS,
pub subscription_identifier: Option<VarByteInt>,
}Expand description
Options for subscription included for every topic.
Fields§
§retain_handling: RetainHandlingServerside retain handling configuration for this subscription.
retain_as_published: boolIf set to true, the server sets the retain flag of a PUBLISH packet matching this subscription to the retain flag value of the original publication. If set to false, the server sets the retain flag of a PUBLISH packet matching this subscription to false. This does not apply for retained messages sent directly after subscribing - these messages always have the retain flag set to 1.
no_local: boolIf set to true, the server does not forward any publications matching this subscription to connections with client identifiers the same as the client identifier of this connection. If set to true on a shared subscription, a protocol error is triggered.
qos: QoSThe maximum quality of service that the server can forward publications matching this subscription with to the client. A quality of service level lower than this can be granted by the server.
subscription_identifier: Option<VarByteInt>The subscription identifier of the subscription. The server will set subscription identifier properties in its PUBLISH packets to the values of all matching subscriptions with a subscription identifier.
Implementations§
Source§impl Options
impl Options
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates options with values coherent to the Default implementations of the fields and
QoS::AtMostOnce.
Sourcepub const fn at_least_once(self) -> Self
pub const fn at_least_once(self) -> Self
Sets the Quality of Service level to 1 (At Least Once).
Sourcepub const fn exactly_once(self) -> Self
pub const fn exactly_once(self) -> Self
Sets the Quality of Service level to 1 (Exactly Once).
Sourcepub const fn retain_handling(self, retain_handling: RetainHandling) -> Self
pub const fn retain_handling(self, retain_handling: RetainHandling) -> Self
Sets the serverside retain handling configuration for this subscription.
Sourcepub const fn retain_as_published(self) -> Self
pub const fn retain_as_published(self) -> Self
Sets the retain as published flag to true.
Sourcepub const fn subscription_identifier(
self,
subscription_identifier: VarByteInt,
) -> Self
pub const fn subscription_identifier( self, subscription_identifier: VarByteInt, ) -> Self
Sets the subscription identifier property.