pub struct BStackSliceWriter<'a, A: BStackAllocator> { /* private fields */ }Expand description
A cursor-based writer over a BStackSlice.
Implements io::Write and io::Seek within the coordinate space of
the slice — position 0 maps to slice.offset in the underlying payload,
and writes cannot exceed slice.offset + slice.len.
Every call to write delegates to BStack::set and
is durably synced before returning.
Constructed via BStackSlice::writer or BStackSlice::writer_at.
Requires the set feature.
Implementations§
Source§impl<'a, A: BStackAllocator> BStackSliceWriter<'a, A>
impl<'a, A: BStackAllocator> BStackSliceWriter<'a, A>
Sourcepub fn position(&self) -> u64
pub fn position(&self) -> u64
Return the current cursor position within the slice (not the payload).
Sourcepub fn slice(&self) -> BStackSlice<'a, A>
pub fn slice(&self) -> BStackSlice<'a, A>
Return the underlying BStackSlice.
Trait Implementations§
Source§impl<'a, A: BStackAllocator> Clone for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> Clone for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> Debug for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> Debug for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> From<BStackSlice<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.Convert a slice into a writer positioned at the start.
impl<'a, A: BStackAllocator> From<BStackSlice<'a, A>> for BStackSliceWriter<'a, A>
set only.Convert a slice into a writer positioned at the start.
Equivalent to BStackSlice::writer.
Source§fn from(slice: BStackSlice<'a, A>) -> Self
fn from(slice: BStackSlice<'a, A>) -> Self
Source§impl<'a, A: BStackAllocator> From<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.Convert a reader into a writer at the same position.
impl<'a, A: BStackAllocator> From<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
set only.Convert a reader into a writer at the same position.
The reader and writer share the same underlying slice and cursor position.
Source§fn from(reader: BStackSliceReader<'a, A>) -> Self
fn from(reader: BStackSliceReader<'a, A>) -> Self
Source§impl<'a, A: BStackAllocator> From<BStackSliceWriter<'a, A>> for BStackSlice<'a, A>
Available on crate feature set only.Convert a writer back into its underlying slice, discarding the cursor.
impl<'a, A: BStackAllocator> From<BStackSliceWriter<'a, A>> for BStackSlice<'a, A>
set only.Convert a writer back into its underlying slice, discarding the cursor.
Equivalent to BStackSliceWriter::slice.
Source§fn from(writer: BStackSliceWriter<'a, A>) -> Self
fn from(writer: BStackSliceWriter<'a, A>) -> Self
Source§impl<'a, A: BStackAllocator> From<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
Available on crate feature set only.Convert a writer into a reader at the same position.
impl<'a, A: BStackAllocator> From<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
set only.Convert a writer into a reader at the same position.
The reader and writer share the same underlying slice and cursor position.
Source§fn from(writer: BStackSliceWriter<'a, A>) -> Self
fn from(writer: BStackSliceWriter<'a, A>) -> Self
Source§impl<'a, A: BStackAllocator> Hash for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> Hash for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> Ord for BStackSliceWriter<'a, A>
Available on crate feature set only.Writers are ordered by absolute payload position (slice.start() + cursor),
then by slice length.
impl<'a, A: BStackAllocator> Ord for BStackSliceWriter<'a, A>
set only.Writers are ordered by absolute payload position (slice.start() + cursor),
then by slice length.
Source§impl<'a, A: BStackAllocator> PartialEq<BStackSlice<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialEq<BStackSlice<'a, A>> for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialEq<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialEq<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialEq<BStackSliceWriter<'a, A>> for BStackSlice<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialEq<BStackSliceWriter<'a, A>> for BStackSlice<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialEq<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialEq<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialEq for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialEq for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialOrd<BStackSlice<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialOrd<BStackSlice<'a, A>> for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialOrd<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialOrd<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialOrd<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialOrd<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialOrd for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialOrd for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> Seek for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> Seek for BStackSliceWriter<'a, A>
set only.Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Move the cursor within the slice’s coordinate space.
io::SeekFrom::End is relative to self.slice.len. Seeking past
the end is allowed; subsequent writes return Ok(0). Seeking before
position 0 returns io::ErrorKind::InvalidInput.
1.55.0 · Source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len)Source§impl<'a, A: BStackAllocator> Write for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> Write for BStackSliceWriter<'a, A>
set only.Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write bytes at the current cursor position, then advance the cursor.
Writes min(buf.len(), remaining) bytes where remaining is
self.slice.len() - self.cursor. Returns Ok(0) when the cursor is
at or past the end of the slice. Every call issues a durable sync.
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)impl<'a, A: BStackAllocator> Eq for BStackSliceWriter<'a, A>
set only.