Skip to content

Commit

Permalink
fix: update README.md to match implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
nfejzic committed Oct 3, 2023
1 parent a834b62 commit b62a0b5
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ assert_eq!(tape.peek_back(), Some(&4));

```rust
use ribbon::Band;
use ribbon::Ribbon;

// Band with capacity for 5 items
let mut band: Band<3, _, _> = Band::new(0..4);
Expand All @@ -51,13 +52,10 @@ assert_eq!(band.len(), 2);
assert_eq!(band.peek_front(), Some(&0));
assert_eq!(band.peek_back(), Some(&1));

// just expands, no need to pop first item
assert_eq!(band.progress(), None); // consume 3 from iterator
// "slides" over the items from iterator -> returns first and expands by 1
assert_eq!(band.progress(), Some(0)); // consume 3 from iterator
assert_eq!(band.progress(), Some(1)); // consumes 4 from iterator, iterator has no more values

// needs space, pops first item
assert_eq!(band.progress(), Some(0)); // consumes 4 from iterator, iterator has no more values

// iterator does not produce more values, progress becomes no-op. No extra capacity is needed,
// hence progress does not return any more values.
// iterator does not produce more values, progress becomes no-op.
assert_eq!(band.progress(), None);
```

0 comments on commit b62a0b5

Please sign in to comment.