Skip to content

Commit

Permalink
Add optional serde support
Browse files Browse the repository at this point in the history
  • Loading branch information
SethDusek committed Oct 9, 2021
1 parent 7fe639f commit 265967f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
thiserror = "1"
serde = {version = "1.0.123", optional = true, default-features = false}

[dev-dependencies]
3 changes: 3 additions & 0 deletions src/bounded_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ use std::convert::{TryFrom, TryInto};
use std::slice::{Iter, IterMut};
use std::vec;
use thiserror::Error;
#[cfg(feature = "serde")]
use serde::{Serialize, Deserialize};

/// Non-empty Vec bounded with minimal (L - lower bound) and maximal (U - upper bound) items quantity
#[derive(PartialEq, Eq, Debug, Clone, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(transparent))]
pub struct BoundedVec<T, const L: usize, const U: usize>
// enable when feature(const_evaluatable_checked) is stable
// where
Expand Down

0 comments on commit 265967f

Please sign in to comment.