mirror of
https://github.com/trussed-dev/flexiber.git
synced 2026-06-20 04:16:10 -07:00
Merge pull request #1 from nickray/bump-heapless
Bump heapless to const generics
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "flexiber"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
authors = ["Nicolas Stalder <n@stalder.io>", "RustCrypto Developers"]
|
||||
license = "Apache-2.0 OR MIT"
|
||||
edition = "2018"
|
||||
@@ -15,7 +15,7 @@ delog = "0.1.0"
|
||||
flexiber_derive = { version = "0.1", optional = true, path = "derive" }
|
||||
|
||||
[dependencies.heapless]
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
optional = true
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
+2
-2
@@ -126,7 +126,7 @@ pub trait Encodable {
|
||||
pub trait EncodableHeapless: Encodable {
|
||||
/// Encode this message as BER-TLV, appending it to the provided
|
||||
/// heapless byte vector.
|
||||
fn encode_to_heapless_vec<N: heapless::ArrayLength<u8>>(&self, buf: &mut heapless::Vec<u8, N>) -> Result<Length> {
|
||||
fn encode_to_heapless_vec<const N: usize>(&self, buf: &mut heapless::Vec<u8, N>) -> Result<Length> {
|
||||
let expected_len = self.encoded_length()?.to_usize();
|
||||
let current_len = buf.len();
|
||||
// TODO(nickray): add a specific error for "Overcapacity" conditional on heapless feature?
|
||||
@@ -148,7 +148,7 @@ pub trait EncodableHeapless: Encodable {
|
||||
}
|
||||
|
||||
/// Serialize this message as a byte vector.
|
||||
fn to_heapless_vec<N: heapless::ArrayLength<u8>>(&self) -> Result<heapless::Vec<u8, N>> {
|
||||
fn to_heapless_vec<const N: usize>(&self) -> Result<heapless::Vec<u8, N>> {
|
||||
let mut buf = heapless::Vec::new();
|
||||
self.encode_to_heapless_vec(&mut buf)?;
|
||||
Ok(buf)
|
||||
|
||||
Reference in New Issue
Block a user