Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Added set_len method to Buffer #1374

Merged
Merged
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
7 changes: 7 additions & 0 deletions src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ impl<T> Buffer<T> {
self.offset
}

/// # Safety
/// The caller must ensure that the buffer was properly initialized up to `len`.
#[inline]
pub unsafe fn set_len(&mut self, len: usize) {
self.length = len;
}

/// Returns a mutable reference to its underlying [`Vec`], if possible.
///
/// This operation returns [`Either::Right`] iff this [`Buffer`]:
Expand Down