Skip to content

Commit

Permalink
Merge pull request #19 from quartiq/feature/version-bumps
Browse files Browse the repository at this point in the history
Feature/version bumps
  • Loading branch information
jordens authored Jun 13, 2024
2 parents a02a613 + 5e28b73 commit f17ed49
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0] - 2024-06-13

* [breaking] Updated to `minimq` v0.9.0


## [0.3.0] - 2023-11-01

* Handlers now take a fourth argument, `output_buffer`, where they can serialize their response into
Expand Down Expand Up @@ -34,6 +39,7 @@ command is registered.

Library initially released on crates.io

[0.4.0]: https://github.com/quartiq/minireq/releases/tag/v0.4.0
[0.3.0]: https://github.com/quartiq/minireq/releases/tag/v0.3.0
[0.2.0]: https://github.com/quartiq/minireq/releases/tag/v0.2.0
[0.1.1]: https://github.com/quartiq/minireq/releases/tag/v0.1.1
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "minireq"
version = "0.3.0"
version = "0.4.0"
edition = "2021"
authors = ["Ryan Summers <[email protected]>"]
license = "MIT"
Expand All @@ -10,8 +10,8 @@ categories = ["no-std", "config", "embedded", "parsing"]
repository = "https://github.com/quartiq/minireq"

[dependencies]
minimq = { version = "0.8.0" }
heapless = {version = "0.7", features = ["serde"] }
minimq = { version = "0.9.0" }
heapless = {version = "0.8", features = ["serde"] }
log = "0.4"
serde = { version = "1", features = ["derive"], default-features = false }
smlang = "0.6"
Expand All @@ -21,6 +21,6 @@ embedded-io = "0.6"
std-embedded-time = "0.1"
tokio = { version = "1.9", features = ["rt-multi-thread", "time", "macros"] }
env_logger = "0.10"
embedded-nal = "0.7"
embedded-nal = "0.8"
serde-json-core = "0.5"
std-embedded-nal = "0.2"
std-embedded-nal = { git = "https://gitlab.com/ryan-summers/std-embedded-nal", branch = "feature/0.8" }
13 changes: 9 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
//! ```
//!
use core::fmt::Write as CoreWrite;
use core::str::FromStr;
use embedded_io::Write;

pub use minimq;
Expand Down Expand Up @@ -263,7 +264,7 @@ where
..
} = self.machine.context_mut();

match mqtt.poll(|client, topic, message, properties| {
let result = mqtt.poll(|client, topic, message, properties| {
let Some(path) = topic.strip_prefix(prefix.as_str()) else {
info!("Unexpected MQTT topic: {}", topic);
return;
Expand Down Expand Up @@ -319,7 +320,9 @@ where
client.publish(message).ok();
};
}
}) {
});

match result {
Ok(_) => Ok(()),
Err(minimq::Error::SessionReset) => {
// Note(unwrap): It's always safe to unwrap the reset event. All states must handle
Expand Down Expand Up @@ -396,7 +399,8 @@ where
fn subscribe(&mut self) -> Result<(), ()> {
// Note(unwrap): We ensure that this storage is always sufficiently large to store
// the wildcard post-fix for MQTT.
let mut prefix: String<{ MAX_TOPIC_LENGTH + 2 }> = String::from(self.prefix.as_str());
let mut prefix: String<{ MAX_TOPIC_LENGTH + 2 }> =
String::from_str(self.prefix.as_str()).unwrap();
prefix.push_str("/#").unwrap();

let topic_prefix = minimq::types::TopicFilter::new(&prefix)
Expand Down Expand Up @@ -447,7 +451,8 @@ where
{
// Note(unwrap): The unwrap cannot fail because of restrictions on the max topic
// length.
let mut topic: String<{ 2 * MAX_TOPIC_LENGTH + 1 }> = String::from(prefix.as_str());
let mut topic: String<{ 2 * MAX_TOPIC_LENGTH + 1 }> =
String::from_str(prefix.as_str()).unwrap();
topic.push_str("/").unwrap();
topic.push_str(command_prefix).unwrap();

Expand Down

0 comments on commit f17ed49

Please sign in to comment.