Struct blocked_vec::BlockedVec
source · [−]pub struct BlockedVec { /* private fields */ }Expand description
A vector of blocks.
See the module documentation for details.
Implementations
sourceimpl BlockedVec
impl BlockedVec
sourcepub fn new_paged(page_layout: Layout) -> Self
pub fn new_paged(page_layout: Layout) -> Self
Creates a new BlockedVec with a given page layout.
sourcepub fn with_len(len: usize) -> Self
pub fn with_len(len: usize) -> Self
Creates a new BlockedVec with an initial length, with the cursor
placed at the front.
Panics
Panics if the queried page size cannot be made into a layout.
sourcepub fn with_len_paged(len: usize, page_layout: Layout) -> Self
pub fn with_len_paged(len: usize, page_layout: Layout) -> Self
Creates a new BlockedVec with a given page layout and an initial
length, with the cursor placed at the front.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of this BlockedVec.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Checks if this BlockedVec is empty.
sourcepub fn extend(&mut self, additional: usize)
pub fn extend(&mut self, additional: usize)
Extend the BlockedVec, with the possible additional areas filled with
zero.
Panics
Panics if the seeker or blocks are inconsistent.
sourcepub fn append_vectored(&mut self, buf: &mut [impl IoSlice<'_>]) -> usize
pub fn append_vectored(&mut self, buf: &mut [impl IoSlice<'_>]) -> usize
sourcepub fn read_vectored(&mut self, buf: &mut [impl IoSliceMut<'_>]) -> usize
pub fn read_vectored(&mut self, buf: &mut [impl IoSliceMut<'_>]) -> usize
Like read, except that it reads into a slice of buffers.
sourcepub fn read_at_vectored(
&mut self,
pos: usize,
buf: &mut [impl IoSliceMut<'_>]
) -> usize
pub fn read_at_vectored(
&mut self,
pos: usize,
buf: &mut [impl IoSliceMut<'_>]
) -> usize
Like read_at, except that it reads into a slice of buffers.
sourcepub fn read(&mut self, buf: &mut [u8]) -> usize
pub fn read(&mut self, buf: &mut [u8]) -> usize
Pull some bytes from this BlockedVec into the specified buffer,
returning how many bytes were read.
sourcepub fn read_at(&mut self, pos: usize, buf: &mut [u8]) -> usize
pub fn read_at(&mut self, pos: usize, buf: &mut [u8]) -> usize
Pull some bytes from this BlockedVec into the specified buffer at a
specified position, returning how many bytes were read.
sourcepub fn write_vectored(&mut self, buf: &mut [impl IoSlice<'_>]) -> usize
pub fn write_vectored(&mut self, buf: &mut [impl IoSlice<'_>]) -> usize
Like write, except that it writes from a slice of buffers.
sourcepub fn write_at_vectored(
&mut self,
pos: usize,
buf: &mut [impl IoSlice<'_>]
) -> usize
pub fn write_at_vectored(
&mut self,
pos: usize,
buf: &mut [impl IoSlice<'_>]
) -> usize
Like write_at, except that it writes from a slice of buffers.
sourcepub fn write(&mut self, buf: &[u8]) -> usize
pub fn write(&mut self, buf: &[u8]) -> usize
Write a buffer into this writer, returning how many bytes were written.
sourcepub fn write_at(&mut self, pos: usize, buf: &[u8]) -> usize
pub fn write_at(&mut self, pos: usize, buf: &[u8]) -> usize
Write a buffer into this writer at a specified position, returning how many bytes were written.
sourcepub fn seek(&mut self, pos: SeekFrom) -> Option<usize>
pub fn seek(&mut self, pos: SeekFrom) -> Option<usize>
Seek to an offset, in bytes, in this BlockedVec.
Trait Implementations
sourceimpl Debug for BlockedVec
impl Debug for BlockedVec
sourceimpl Default for BlockedVec
impl Default for BlockedVec
sourceimpl Read for BlockedVec
impl Read for BlockedVec
sourcefn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
sourcefn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
read, except that it reads into a slice of buffers. Read moresourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · sourcefn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
buf. Read more1.0.0 · sourcefn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moresourcefn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)sourcefn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · sourcefn by_ref(&mut self) -> &mut Self
fn by_ref(&mut self) -> &mut Self
Read. Read moresourceimpl Seek for BlockedVec
impl Seek for BlockedVec
sourcefn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
1.55.0 · sourcefn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
sourceimpl Write for BlockedVec
impl Write for BlockedVec
sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
sourcefn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>
sourcefn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
sourcefn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · sourcefn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
sourcefn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)