Skip to content

Commit

Permalink
adds assert to example of Index::for_len_unchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
chanced committed Jul 2, 2024
1 parent a67948d commit 4ce6c00
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ impl Index {
/// # use jsonptr::Index;
/// assert_eq!(Index::Num(42).for_len_unchecked(30), 42);
/// assert_eq!(Index::Next.for_len_unchecked(30), 30);
///
/// // no bounds checks
/// assert_eq!(Index::Num(34).for_len_unchecked(40), 40);
/// assert_eq!(Index::Next.for_len_unchecked(34), 34);
/// ````
pub fn for_len_unchecked(&self, length: usize) -> usize {
match *self {
Self::Num(idx) => idx,
Expand Down

0 comments on commit 4ce6c00

Please sign in to comment.