Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free Disk Space (Ubuntu)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
Expand Down Expand Up @@ -76,6 +93,9 @@ jobs:
- name: Run tests (no-std + tracing, no SSO)
run: cargo test --verbose --no-default-features --features tracing -- --nocapture

- name: Clean build artifacts before SSO tests
run: cargo clean

- name: Run tests with SSO features
run: |
cargo test --verbose --features std,sso-min-32bit -- --nocapture
Expand All @@ -98,6 +118,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 0.7.3

* Fix SubEntry code example. #56
* Fix auto_map_topic_alias_send logic. #55
* Minimize copy for MqttString and MqttBinary. #54
* Add Option type packet_id() support for Publish packet builder. #53
* Optionally derive defmt::Format for some types. #48
* Avoid duplicate libraries when building with -Zbuild-std. #47
* Fall back to Rc on targets without atomics. #46



# 0.7.2

* Fix missing properties on CONNACK packet. #44
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mqtt-protocol-core"
version = "0.7.2"
version = "0.7.3"
edition = "2021"
rust-version = "1.86.0"
license = "MIT"
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Add this to your `Cargo.toml`:

```toml
[dependencies]
mqtt-protocol-core = "0.7.2"
mqtt-protocol-core = "0.7.3"
```

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

```toml
[dependencies]
mqtt-protocol-core = { version = "0.7.2", default-features = false }
mqtt-protocol-core = { version = "0.7.3", default-features = false }
```

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

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

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

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

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

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

[features]
# You MUST re-export ALL SSO features to allow downstream configuration
Expand Down
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
//!
//! ```toml
//! [dependencies]
//! mqtt-protocol-core = { version = "0.7.2", default-features = false }
//! mqtt-protocol-core = { version = "0.7.3", default-features = false }
//! ```
//!
//! **No-std usage example:**
Expand Down Expand Up @@ -173,15 +173,15 @@
//! ```toml
//! # Enable tracing support (independent of std)
//! [dependencies]
//! mqtt-protocol-core = { version = "0.7.2", default-features = false, features = ["tracing"] }
//! mqtt-protocol-core = { version = "0.7.3", default-features = false, features = ["tracing"] }
//!
//! # Use with std but without tracing overhead
//! [dependencies]
//! mqtt-protocol-core = { version = "0.7.2", default-features = false, features = ["std"] }
//! mqtt-protocol-core = { version = "0.7.3", default-features = false, features = ["std"] }
//!
//! # Full-featured (std + tracing)
//! [dependencies]
//! mqtt-protocol-core = { version = "0.7.2", features = ["tracing"] }
//! mqtt-protocol-core = { version = "0.7.3", features = ["tracing"] }
//! ```
//!
//! ### Small String Optimization (SSO) Features
Expand All @@ -208,11 +208,11 @@
//! ```toml
//! # Use specific SSO optimization level
//! [dependencies]
//! mqtt-protocol-core = { version = "0.7.2", features = ["sso-lv10"] }
//! mqtt-protocol-core = { version = "0.7.3", features = ["sso-lv10"] }
//!
//! # Combine with other features
//! [dependencies]
//! mqtt-protocol-core = { version = "0.7.2", features = ["std", "sso-lv20", "tracing"] }
//! mqtt-protocol-core = { version = "0.7.3", features = ["std", "sso-lv20", "tracing"] }
//! ```
//!
//! #### ⚠️ **Critical: SSO Feature Flag Propagation**
Expand All @@ -234,7 +234,7 @@
//! ```toml
//! # Your crate's Cargo.toml
//! [dependencies]
//! mqtt-protocol-core = { version = "0.7.2", features = ["sso-lv10"] }
//! mqtt-protocol-core = { version = "0.7.3", features = ["sso-lv10"] }
//!
//! [features]
//! # MANDATORY: Re-export ALL SSO features to allow downstream configuration
Expand Down
120 changes: 48 additions & 72 deletions src/mqtt/packet/v3_1_1/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,10 @@ use crate::mqtt::result_code::MqttError;
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(42)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("sensors/temperature")
/// .unwrap()
/// .qos(Qos::AtLeastOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "sensors/temperature",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand All @@ -125,18 +123,14 @@ use crate::mqtt::result_code::MqttError;
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(123)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("home/+/temperature")
/// .unwrap()
/// .qos(Qos::AtMostOnce)
/// .build()
/// .unwrap(),
/// SubEntry::builder()
/// .topic_filter("alerts/#")
/// .unwrap()
/// .qos(Qos::ExactlyOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "home/+/temperature",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
/// )?,
/// SubEntry::new(
/// "alerts/#",
/// mqtt::packet::SubOpts::new().set_qos(Qos::ExactlyOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -180,12 +174,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(1)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("my/topic")
/// .unwrap()
/// .qos(Qos::AtLeastOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "my/topic",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -216,12 +208,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(42)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("sensors/+")
/// .unwrap()
/// .qos(Qos::AtLeastOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "sensors/+",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -272,12 +262,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(123)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("test/topic")
/// .unwrap()
/// .qos(Qos::AtMostOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "test/topic",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -375,12 +363,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(1)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("test")
/// .unwrap()
/// .qos(Qos::AtMostOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "test",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -416,12 +402,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(1)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("test/topic")
/// .unwrap()
/// .qos(Qos::AtLeastOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "test/topic",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -552,12 +536,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(1)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("sensors/temperature")
/// .unwrap()
/// .qos(Qos::AtMostOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "sensors/temperature",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -599,12 +581,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(42)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("test/topic")
/// .unwrap()
/// .qos(Qos::AtLeastOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "test/topic",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtLeastOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -639,12 +619,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(1)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("debug/topic")
/// .unwrap()
/// .qos(Qos::AtMostOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "debug/topic",
/// mqtt::packet::SubOpts::new().set_qos(Qos::AtMostOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down Expand Up @@ -682,12 +660,10 @@ where
/// let subscribe = mqtt::packet::v3_1_1::Subscribe::builder()
/// .packet_id(123)
/// .entries(vec![
/// SubEntry::builder()
/// .topic_filter("home/sensor")
/// .unwrap()
/// .qos(Qos::ExactlyOnce)
/// .build()
/// .unwrap()
/// SubEntry::new(
/// "home/sensor",
/// mqtt::packet::SubOpts::new().set_qos(Qos::ExactlyOnce)
/// )?
/// ])
/// .build()
/// .unwrap();
Expand Down
Loading