mirror of
https://github.com/rust-embedded/heapless.git
synced 2025-09-28 04:50:34 +00:00
Support defmt version range (0.2 and 0.3)
This commit is contained in:
parent
8a77f3237f
commit
cd754b7936
@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [v0.7.8] - 2021-11-11
|
||||
|
||||
### Added
|
||||
|
||||
- A span of `defmt` versions is now supported (`0.2` and `0.3`)
|
||||
|
||||
## [v0.7.7] - 2021-09-22
|
||||
|
||||
### Fixed
|
||||
@ -417,7 +423,8 @@ architecture.
|
||||
|
||||
- Initial release
|
||||
|
||||
[Unreleased]: https://github.com/japaric/heapless/compare/v0.7.7...HEAD
|
||||
[Unreleased]: https://github.com/japaric/heapless/compare/v0.7.8...HEAD
|
||||
[v0.7.9]: https://github.com/japaric/heapless/compare/v0.7.7...v0.7.8
|
||||
[v0.7.7]: https://github.com/japaric/heapless/compare/v0.7.6...v0.7.7
|
||||
[v0.7.6]: https://github.com/japaric/heapless/compare/v0.7.5...v0.7.6
|
||||
[v0.7.5]: https://github.com/japaric/heapless/compare/v0.7.4...v0.7.5
|
||||
|
@ -12,7 +12,7 @@ keywords = ["static", "no-heap"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
name = "heapless"
|
||||
repository = "https://github.com/japaric/heapless"
|
||||
version = "0.7.7"
|
||||
version = "0.7.8"
|
||||
|
||||
[features]
|
||||
default = ["cas"]
|
||||
@ -24,6 +24,7 @@ x86-sync-pool = []
|
||||
__trybuild = []
|
||||
# Enable larger MPMC sizes.
|
||||
mpmc_large = []
|
||||
# This flag has no version guarantee, the `defmt` dependency can be updated in a patch release
|
||||
defmt-impl = ["defmt"]
|
||||
|
||||
[target.'cfg(any(target_arch = "x86_64", target_arch = "x86"))'.dev-dependencies]
|
||||
@ -55,9 +56,5 @@ optional = true
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.defmt]
|
||||
version = "0.2.1"
|
||||
version = ">=0.2.0,<0.4"
|
||||
optional = true
|
||||
|
||||
[dev-dependencies.defmt]
|
||||
version = "0.2.1"
|
||||
features = ["unstable-test"]
|
||||
|
33
src/defmt.rs
33
src/defmt.rs
@ -21,36 +21,3 @@ where
|
||||
defmt::write!(fmt, "{=str}", self.as_str());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::Vec;
|
||||
use defmt::Format;
|
||||
|
||||
#[test]
|
||||
/// Tests encoding Vec with defmt, asserting these types may be serialized
|
||||
/// Note: the exact wire format is NOT checked since its an unstable implementation detail of an external crate.
|
||||
/// based on https://github.com/knurling-rs/defmt/blob/697a8e807bd766a80ada2d57514a9da1232dbc9a/tests/encode.rs#L523
|
||||
fn test_defmt_format_vec() {
|
||||
let val: Vec<_, 8> = Vec::from_slice(b"abc").unwrap();
|
||||
|
||||
let mut f = defmt::InternalFormatter::new();
|
||||
let g = defmt::Formatter { inner: &mut f };
|
||||
val.format(g);
|
||||
f.finalize();
|
||||
}
|
||||
|
||||
/// Tests encoding String with defmt, asserting these types may be serialized
|
||||
/// Note: the exact wire format is NOT checked since its an unstable implementation detail of an external crate.
|
||||
/// based loosely on https://github.com/knurling-rs/defmt/blob/main/tests/encode.rs#L483
|
||||
#[test]
|
||||
fn test_defmt_format_str() {
|
||||
let mut val: crate::String<32> = crate::String::new();
|
||||
val.push_str("foo").unwrap();
|
||||
|
||||
let mut f = defmt::InternalFormatter::new();
|
||||
let g = defmt::Formatter { inner: &mut f };
|
||||
val.format(g);
|
||||
f.finalize();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user