Skip to content

Commit 4467668

Browse files
committed
Fix SubEntry code examples.
Update the version to 0.7.3.
1 parent 199dca1 commit 4467668

File tree

6 files changed

+124
-156
lines changed

6 files changed

+124
-156
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# 0.7.3
2+
3+
* Fix SubEntry code example. #56
4+
* Fix auto_map_topic_alias_send logic. #55
5+
* Minimize copy for MqttString and MqttBinary. #54
6+
* Add Option type packet_id() support for Publish packet builder. #53
7+
* Optionally derive defmt::Format for some types. #48
8+
* Avoid duplicate libraries when building with -Zbuild-std. #47
9+
* Fall back to Rc on targets without atomics. #46
10+
11+
12+
113
# 0.7.2
214

315
* Fix missing properties on CONNACK packet. #44

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mqtt-protocol-core"
3-
version = "0.7.2"
3+
version = "0.7.3"
44
edition = "2021"
55
rust-version = "1.86.0"
66
license = "MIT"

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add this to your `Cargo.toml`:
3838

3939
```toml
4040
[dependencies]
41-
mqtt-protocol-core = "0.7.2"
41+
mqtt-protocol-core = "0.7.3"
4242
```
4343

4444
### No-std Support
@@ -47,7 +47,7 @@ For `no_std` environments (embedded systems), disable the default `std` feature:
4747

4848
```toml
4949
[dependencies]
50-
mqtt-protocol-core = { version = "0.7.2", default-features = false }
50+
mqtt-protocol-core = { version = "0.7.3", default-features = false }
5151
```
5252

5353
Caveats:
@@ -64,15 +64,15 @@ The library supports several optional features that can be enabled/disabled as n
6464
```toml
6565
# Enable tracing support (independent of std)
6666
[dependencies]
67-
mqtt-protocol-core = { version = "0.7.2", default-features = false, features = ["tracing"] }
67+
mqtt-protocol-core = { version = "0.7.3", default-features = false, features = ["tracing"] }
6868

6969
# Use with std but without tracing
7070
[dependencies]
71-
mqtt-protocol-core = { version = "0.7.2", default-features = false, features = ["std"] }
71+
mqtt-protocol-core = { version = "0.7.3", default-features = false, features = ["std"] }
7272

7373
# Full-featured (std + tracing)
7474
[dependencies]
75-
mqtt-protocol-core = { version = "0.7.2", features = ["tracing"] }
75+
mqtt-protocol-core = { version = "0.7.3", features = ["tracing"] }
7676
```
7777

7878
### Small String Optimization (SSO) Features
@@ -87,11 +87,11 @@ This crate provides SSO features to optimize memory usage for small string and b
8787
```toml
8888
# Use specific SSO optimization level
8989
[dependencies]
90-
mqtt-protocol-core = { version = "0.7.2", features = ["sso-lv10"] }
90+
mqtt-protocol-core = { version = "0.7.3", features = ["sso-lv10"] }
9191

9292
# Combine with other features
9393
[dependencies]
94-
mqtt-protocol-core = { version = "0.7.2", features = ["std", "sso-lv20", "tracing"] }
94+
mqtt-protocol-core = { version = "0.7.3", features = ["std", "sso-lv20", "tracing"] }
9595
```
9696

9797
#### ⚠️ **Important: Feature Flag Propagation Requirement**
@@ -110,7 +110,7 @@ When your crate depends on `mqtt-protocol-core` and is used by other crates or a
110110
```toml
111111
# Your crate's Cargo.toml
112112
[dependencies]
113-
mqtt-protocol-core = { version = "0.7.2", features = ["sso-lv10"] }
113+
mqtt-protocol-core = { version = "0.7.3", features = ["sso-lv10"] }
114114

115115
[features]
116116
# You MUST re-export ALL SSO features to allow downstream configuration

src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
//!
122122
//! ```toml
123123
//! [dependencies]
124-
//! mqtt-protocol-core = { version = "0.7.2", default-features = false }
124+
//! mqtt-protocol-core = { version = "0.7.3", default-features = false }
125125
//! ```
126126
//!
127127
//! **No-std usage example:**
@@ -173,15 +173,15 @@
173173
//! ```toml
174174
//! # Enable tracing support (independent of std)
175175
//! [dependencies]
176-
//! mqtt-protocol-core = { version = "0.7.2", default-features = false, features = ["tracing"] }
176+
//! mqtt-protocol-core = { version = "0.7.3", default-features = false, features = ["tracing"] }
177177
//!
178178
//! # Use with std but without tracing overhead
179179
//! [dependencies]
180-
//! mqtt-protocol-core = { version = "0.7.2", default-features = false, features = ["std"] }
180+
//! mqtt-protocol-core = { version = "0.7.3", default-features = false, features = ["std"] }
181181
//!
182182
//! # Full-featured (std + tracing)
183183
//! [dependencies]
184-
//! mqtt-protocol-core = { version = "0.7.2", features = ["tracing"] }
184+
//! mqtt-protocol-core = { version = "0.7.3", features = ["tracing"] }
185185
//! ```
186186
//!
187187
//! ### Small String Optimization (SSO) Features
@@ -208,11 +208,11 @@
208208
//! ```toml
209209
//! # Use specific SSO optimization level
210210
//! [dependencies]
211-
//! mqtt-protocol-core = { version = "0.7.2", features = ["sso-lv10"] }
211+
//! mqtt-protocol-core = { version = "0.7.3", features = ["sso-lv10"] }
212212
//!
213213
//! # Combine with other features
214214
//! [dependencies]
215-
//! mqtt-protocol-core = { version = "0.7.2", features = ["std", "sso-lv20", "tracing"] }
215+
//! mqtt-protocol-core = { version = "0.7.3", features = ["std", "sso-lv20", "tracing"] }
216216
//! ```
217217
//!
218218
//! #### ⚠️ **Critical: SSO Feature Flag Propagation**
@@ -234,7 +234,7 @@
234234
//! ```toml
235235
//! # Your crate's Cargo.toml
236236
//! [dependencies]
237-
//! mqtt-protocol-core = { version = "0.7.2", features = ["sso-lv10"] }
237+
//! mqtt-protocol-core = { version = "0.7.3", features = ["sso-lv10"] }
238238
//!
239239
//! [features]
240240
//! # MANDATORY: Re-export ALL SSO features to allow downstream configuration

src/mqtt/packet/v3_1_1/subscribe.rs

Lines changed: 48 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,10 @@ use crate::mqtt::result_code::MqttError;
107107
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
108108
/// .packet_id(42)
109109
/// .entries(vec![
110-
/// SubEntry::builder()
111-
/// .topic_filter("sensors/temperature")
112-
/// .unwrap()
113-
/// .qos(Qos::AtLeastOnce)
114-
/// .build()
115-
/// .unwrap()
110+
/// SubEntry::new(
111+
/// "sensors/temperature",
112+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
113+
/// )?
116114
/// ])
117115
/// .build()
118116
/// .unwrap();
@@ -125,18 +123,14 @@ use crate::mqtt::result_code::MqttError;
125123
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
126124
/// .packet_id(123)
127125
/// .entries(vec![
128-
/// SubEntry::builder()
129-
/// .topic_filter("home/+/temperature")
130-
/// .unwrap()
131-
/// .qos(Qos::AtMostOnce)
132-
/// .build()
133-
/// .unwrap(),
134-
/// SubEntry::builder()
135-
/// .topic_filter("alerts/#")
136-
/// .unwrap()
137-
/// .qos(Qos::ExactlyOnce)
138-
/// .build()
139-
/// .unwrap()
126+
/// SubEntry::new(
127+
/// "home/+/temperature",
128+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
129+
/// )?,
130+
/// SubEntry::new(
131+
/// "alerts/#",
132+
/// mqtt::packet::SubOpts::new().set_qos(Qos::ExactlyOnce)
133+
/// )?
140134
/// ])
141135
/// .build()
142136
/// .unwrap();
@@ -180,12 +174,10 @@ where
180174
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
181175
/// .packet_id(1)
182176
/// .entries(vec![
183-
/// SubEntry::builder()
184-
/// .topic_filter("my/topic")
185-
/// .unwrap()
186-
/// .qos(Qos::AtLeastOnce)
187-
/// .build()
188-
/// .unwrap()
177+
/// SubEntry::new(
178+
/// "my/topic",
179+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
180+
/// )?
189181
/// ])
190182
/// .build()
191183
/// .unwrap();
@@ -216,12 +208,10 @@ where
216208
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
217209
/// .packet_id(42)
218210
/// .entries(vec![
219-
/// SubEntry::builder()
220-
/// .topic_filter("sensors/+")
221-
/// .unwrap()
222-
/// .qos(Qos::AtLeastOnce)
223-
/// .build()
224-
/// .unwrap()
211+
/// SubEntry::new(
212+
/// "sensors/+",
213+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
214+
/// )?
225215
/// ])
226216
/// .build()
227217
/// .unwrap();
@@ -272,12 +262,10 @@ where
272262
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
273263
/// .packet_id(123)
274264
/// .entries(vec![
275-
/// SubEntry::builder()
276-
/// .topic_filter("test/topic")
277-
/// .unwrap()
278-
/// .qos(Qos::AtMostOnce)
279-
/// .build()
280-
/// .unwrap()
265+
/// SubEntry::new(
266+
/// "test/topic",
267+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
268+
/// )?
281269
/// ])
282270
/// .build()
283271
/// .unwrap();
@@ -375,12 +363,10 @@ where
375363
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
376364
/// .packet_id(1)
377365
/// .entries(vec![
378-
/// SubEntry::builder()
379-
/// .topic_filter("test")
380-
/// .unwrap()
381-
/// .qos(Qos::AtMostOnce)
382-
/// .build()
383-
/// .unwrap()
366+
/// SubEntry::new(
367+
/// "test",
368+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
369+
/// )?
384370
/// ])
385371
/// .build()
386372
/// .unwrap();
@@ -416,12 +402,10 @@ where
416402
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
417403
/// .packet_id(1)
418404
/// .entries(vec![
419-
/// SubEntry::builder()
420-
/// .topic_filter("test/topic")
421-
/// .unwrap()
422-
/// .qos(Qos::AtLeastOnce)
423-
/// .build()
424-
/// .unwrap()
405+
/// SubEntry::new(
406+
/// "test/topic",
407+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
408+
/// )?
425409
/// ])
426410
/// .build()
427411
/// .unwrap();
@@ -552,12 +536,10 @@ where
552536
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
553537
/// .packet_id(1)
554538
/// .entries(vec![
555-
/// SubEntry::builder()
556-
/// .topic_filter("sensors/temperature")
557-
/// .unwrap()
558-
/// .qos(Qos::AtMostOnce)
559-
/// .build()
560-
/// .unwrap()
539+
/// SubEntry::new(
540+
/// "sensors/temperature",
541+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
542+
/// )?
561543
/// ])
562544
/// .build()
563545
/// .unwrap();
@@ -599,12 +581,10 @@ where
599581
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
600582
/// .packet_id(42)
601583
/// .entries(vec![
602-
/// SubEntry::builder()
603-
/// .topic_filter("test/topic")
604-
/// .unwrap()
605-
/// .qos(Qos::AtLeastOnce)
606-
/// .build()
607-
/// .unwrap()
584+
/// SubEntry::new(
585+
/// "test/topic",
586+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
587+
/// )?
608588
/// ])
609589
/// .build()
610590
/// .unwrap();
@@ -639,12 +619,10 @@ where
639619
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
640620
/// .packet_id(1)
641621
/// .entries(vec![
642-
/// SubEntry::builder()
643-
/// .topic_filter("debug/topic")
644-
/// .unwrap()
645-
/// .qos(Qos::AtMostOnce)
646-
/// .build()
647-
/// .unwrap()
622+
/// SubEntry::new(
623+
/// "debug/topic",
624+
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
625+
/// )?
648626
/// ])
649627
/// .build()
650628
/// .unwrap();
@@ -682,12 +660,10 @@ where
682660
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
683661
/// .packet_id(123)
684662
/// .entries(vec![
685-
/// SubEntry::builder()
686-
/// .topic_filter("home/sensor")
687-
/// .unwrap()
688-
/// .qos(Qos::ExactlyOnce)
689-
/// .build()
690-
/// .unwrap()
663+
/// SubEntry::new(
664+
/// "home/sensor",
665+
/// mqtt::packet::SubOpts::new().set_qos(Qos::ExactlyOnce)
666+
/// )?
691667
/// ])
692668
/// .build()
693669
/// .unwrap();

0 commit comments

Comments
 (0)