Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

## bounded-vec
`BoundedVec<T, L, U>` - Non-empty rust `std::vec::Vec` wrapper with type guarantees on lower(`L`) and upper(`U`) bounds for items quantity. Inspired by [vec1](https://github.com/rustonaut/vec1).

This crate is `#![no_std]` compatible with `alloc`.

## Example
Expand All @@ -21,8 +22,8 @@ assert_eq!(data, [2u8,4].into());
```

## Crate features
- optional(non-default) `serde` feature that adds serialization to `BoundedVec`.
- optional(non-default) `schema` feature that adds JSON schema support via `schemars` (requires `serde`).
- optional(non-default) [serde](https://serde.rs/) feature that adds serialization to `BoundedVec`.
- optional(non-default) `schema` feature that adds JSON schema support via [schemars](https://graham.cool/schemars) (requires `serde`).
- optional(non-default) `arbitrary` feature that adds `proptest::Arbitrary` implementation to `BoundedVec`.

## Changelog
Expand Down
4 changes: 2 additions & 2 deletions src/bounded_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
///
/// # Type Parameters
///
/// * `W` - witness type to prove vector ranges and shape if interface accordingly
/// * `W` - witness type to prove vector ranges and shape of interface accordingly
#[derive(PartialEq, Eq, Debug, Clone, Hash, PartialOrd, Ord)]
pub struct BoundedVec<T, const L: usize, const U: usize, W = witnesses::NonEmpty<L, U>> {
inner: Vec<T>,
Expand Down Expand Up @@ -149,7 +149,7 @@
}
}

/// Part which works for all witnesses
/// Methods which works for all witnesses
impl<T, const L: usize, const U: usize, W> BoundedVec<T, L, U, W> {
/// Returns a reference to underlying `Vec``
///
Expand Down Expand Up @@ -564,9 +564,9 @@
}
}

/// Option<BoundedVec<T, _, _>> to Vec<T>

Check warning on line 567 in src/bounded_vec.rs

View workflow job for this annotation

GitHub Actions / Intra-documentation links

unclosed HTML tag `T`
pub trait OptBoundedVecToVec<T> {
/// Option<BoundedVec<T, _, _>> to Vec<T>

Check warning on line 569 in src/bounded_vec.rs

View workflow job for this annotation

GitHub Actions / Intra-documentation links

unclosed HTML tag `T`
fn to_vec(self) -> Vec<T>;
}

Expand Down
Loading