Skip to content

Commit

Permalink
Also default HVec
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmunns committed Jun 9, 2022
1 parent 847e1be commit 89791ba
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ser/flavors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,19 @@ mod heapless_vec {

/// The `HVec` flavor is a wrapper type around a `heapless::Vec`. This is a stack
/// allocated data structure, with a fixed maximum size and variable amount of contents.
#[derive(Default)]
pub struct HVec<const B: usize> {
/// TODO
pub vec: Vec<u8, B>
}

impl<const B: usize> HVec<B> {
/// TODO
pub fn new() -> Self {
Self::default()
}
}

impl<'a, const B: usize> Flavor for HVec<B> {
type Output = Vec<u8, B>;

Expand Down Expand Up @@ -291,14 +299,6 @@ mod heapless_vec {
&mut self.vec[idx]
}
}

impl<const B: usize> Default for HVec<B> {
fn default() -> Self {
Self {
vec: Vec::new()
}
}
}
}

#[cfg(feature = "use-std")]
Expand Down

0 comments on commit 89791ba

Please sign in to comment.