Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ impl Buf {
pub fn limits(&self) -> &Limits {
&self.limits
}

/// Reset the buffer.
pub fn reset(&mut self) {
self.inner.clear();
self.limits = Limits::new();
}

#[inline]
pub(crate) fn push_val<T: Primitive>(&mut self, value: T) {
Expand Down
6 changes: 6 additions & 0 deletions src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ impl Chunk {
pub fn refs(&self) -> impl ExactSizeIterator<Item = Ref> + '_ {
self.offsets.iter().map(|&(id, _)| id)
}

/// Reset the chunk.
pub fn reset(&mut self) {
self.buf.reset();
self.offsets.clear();
}

/// Returns the limits of data written into the chunk.
pub fn limits(&self) -> &Limits {
Expand Down
Loading