Skip to content

Commit

Permalink
Improve documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelPaddon committed May 11, 2024
1 parent d762cea commit 2150dc9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/util/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ where
///
#[derive(Clone, Debug, Default)]
pub struct BlockBuffer<T, const N: usize> {
// a fixed length buffer
// a buffer backed by a fixed length array
buffer: ArrayVec<T, N>
}

Expand All @@ -130,6 +130,15 @@ where
///
/// Any remaining values that don't make a up a complete block
/// are buffered and prepended to the next slice passed in.
///
/// Typical usage is:
/// '''
/// let buffer = BlockBuffer::<u8; 8>::new();
/// for block in buffer.blocks("hello world".as_bytes()) {
/// // process block
/// }
/// assert_eq!(buffer.len(), 3);
/// '''
pub fn blocks<'a: 'b, 'b>(&'a mut self, values: &'b [T])
-> Blocks<'a, 'b, T, N>
{
Expand Down

0 comments on commit 2150dc9

Please sign in to comment.