Skip to content

Commit 4cdbde7

Browse files
Add support for heapless 0.9 and heapless-bytes 0.5
1 parent bd92517 commit 4cdbde7

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ categories = ["development-tools", "embedded"]
1515
delog = "0.1.0-alpha.3"
1616
heapless-bytes-v0-3 = { package = "heapless-bytes", version = "0.3", optional = true }
1717
heapless-bytes-v0-4 = { package = "heapless-bytes", version = "0.4", optional = true }
18+
heapless-bytes-v0-5 = { package = "heapless-bytes", version = "0.5", optional = true }
1819
heapless-v0-7 = { package = "heapless", version = "0.7", optional = true }
1920
heapless-v0-8 = { package = "heapless", version = "0.8", optional = true }
21+
heapless-v0-9 = { package = "heapless", version = "0.9", optional = true }
2022
serde = { version = "1", default-features = false }
2123

2224
[dev-dependencies]
23-
heapless-v0-8 = { package = "heapless", version = "0.8", features = ["serde"] }
24-
heapless-bytes-v0-4 = { package = "heapless-bytes", version = "0.4" }
25+
heapless-v0-9 = { package = "heapless", version = "0.8", features = ["serde"] }
26+
heapless-bytes-v0-5 = { package = "heapless-bytes", version = "0.5" }
2527
serde = { version = "1", default-features = false, features = ["derive"] }
2628
serde_bytes = "0.11.12"
2729

@@ -30,9 +32,12 @@ heapless-bytes-v0-3 = ["dep:heapless-bytes-v0-3", "heapless-v0-7"]
3032
heapless-bytes-v0-4 = ["dep:heapless-bytes-v0-4"]
3133
heapless-v0-7 = ["dep:heapless-v0-7"]
3234
heapless-v0-8 = ["dep:heapless-v0-8"]
35+
heapless-bytes-v0-5 = ["dep:heapless-bytes-v0-5"]
36+
heapless-v0-9 = ["dep:heapless-v0-9"]
3337

3438
log-all = []
3539
log-none = []
40+
log-trace = []
3641
log-info = []
3742
log-debug = []
3843
log-warn = []

src/de.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,26 +1056,26 @@ mod tests {
10561056
}
10571057

10581058
#[cfg_attr(
1059-
not(feature = "heapless-bytes-v0-4"),
1060-
ignore = "Enable heapless-bytes-v0-4 feature"
1059+
not(feature = "heapless-bytes-v0-5"),
1060+
ignore = "Enable heapless-bytes-v0-5 feature"
10611061
)]
10621062
#[test]
10631063
fn de_bytes() {
1064-
#[cfg(feature = "heapless-bytes-v0-4")]
1064+
#[cfg(feature = "heapless-bytes-v0-5")]
10651065
{
10661066
let mut buf = [0u8; 64];
10671067

10681068
let slice = b"thank you postcard!";
1069-
let bytes = heapless_bytes_v0_4::Bytes::<64>::try_from(slice).unwrap();
1069+
let bytes = heapless_bytes_v0_5::Bytes::<64>::try_from(slice).unwrap();
10701070
let ser = cbor_serialize(&bytes, &mut buf).unwrap();
10711071
println!("serialized bytes = {:?}", ser);
1072-
let de: heapless_bytes_v0_4::Bytes<64> = from_bytes(&buf).unwrap();
1072+
let de: heapless_bytes_v0_5::Bytes<64> = from_bytes(&buf).unwrap();
10731073
println!("deserialized bytes = {:?}", &de);
10741074
assert_eq!(&de, slice);
10751075
}
1076-
#[cfg(not(feature = "heapless-bytes-v0-4"))]
1076+
#[cfg(not(feature = "heapless-bytes-v0-5"))]
10771077
{
1078-
panic!("This test must be run with the heapless-v0-4 feature")
1078+
panic!("This test must be run with the heapless-v0-5 feature")
10791079
}
10801080
}
10811081

@@ -1084,10 +1084,10 @@ mod tests {
10841084
let mut buf = [0u8; 64];
10851085

10861086
let string_slice = "thank you postcard, for blazing the path 🐝";
1087-
let mut string = heapless_v0_8::String::<64>::new();
1087+
let mut string = heapless_v0_9::String::<64>::new();
10881088
string.push_str(string_slice).unwrap();
10891089
let _n = cbor_serialize(&string, &mut buf);
1090-
let de: heapless_v0_8::String<64> = from_bytes(&buf).unwrap();
1090+
let de: heapless_v0_9::String<64> = from_bytes(&buf).unwrap();
10911091
assert_eq!(de, string_slice);
10921092
}
10931093

0 commit comments

Comments
 (0)