Skip to content

Commit 80a0ac7

Browse files
authored
feat(rumqttc): add MqttOptions::set_client_id method (#954)
Other fields have respective setters, client_id has not, and I find it useful. Signed-off-by: Stanislav Ravas <[email protected]>
1 parent b1c3a20 commit 80a0ac7

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

rumqttc/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
* `set_session_expiry_interval` and `session_expiry_interval` methods on `MqttOptions`.
1616
* `Auth` packet as per MQTT5 standards
1717
* Allow configuring the `nodelay` property of underlying TCP client with the `tcp_nodelay` field in `NetworkOptions`
18+
* `set_client_id` method on `MqttOptions`
1819

1920
### Changed
2021

rumqttc/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,11 @@ impl MqttOptions {
563563
self.last_will.clone()
564564
}
565565

566+
pub fn set_client_id(&mut self, client_id: String) -> &mut Self {
567+
self.client_id = client_id;
568+
self
569+
}
570+
566571
pub fn set_transport(&mut self, transport: Transport) -> &mut Self {
567572
self.transport = transport;
568573
self

rumqttc/src/v5/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ impl MqttOptions {
215215
self.request_modifier.clone()
216216
}
217217

218+
pub fn set_client_id(&mut self, client_id: String) -> &mut Self {
219+
self.client_id = client_id;
220+
self
221+
}
222+
218223
pub fn set_transport(&mut self, transport: Transport) -> &mut Self {
219224
self.transport = transport;
220225
self

0 commit comments

Comments
 (0)