Trait system_interface::fs::FileIoExt [−][src]
pub trait FileIoExt {
Show methods
fn advise(&self, offset: u64, len: u64, advice: Advice) -> Result<()>;
fn allocate(&self, offset: u64, len: u64) -> Result<()>;
fn read(&self, buf: &mut [u8]) -> Result<usize>;
fn read_exact(&self, buf: &mut [u8]) -> Result<()>;
fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize>;
fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<()>;
fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>;
fn read_to_end(&self, buf: &mut Vec<u8>) -> Result<usize>;
fn read_to_end_at(&self, buf: &mut Vec<u8>, offset: u64) -> Result<usize>;
fn read_to_string(&self, buf: &mut String) -> Result<usize>;
fn read_to_string_at(&self, buf: &mut String, offset: u64) -> Result<usize>;
fn peek(&self, buf: &mut [u8]) -> Result<usize>;
fn write(&self, buf: &[u8]) -> Result<usize>;
fn write_all(&self, buf: &[u8]) -> Result<()>;
fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize>;
fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<()>;
fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize>;
fn write_fmt(&self, fmt: Arguments<'_>) -> Result<()>;
fn flush(&self) -> Result<()>;
fn seek(&self, pos: SeekFrom) -> Result<u64>;
fn stream_position(&self) -> Result<u64>;
fn read_exact_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<()> { ... }
fn read_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<usize> { ... }
fn read_exact_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<()> { ... }
fn is_read_vectored_at(&self) -> bool { ... }
fn write_all_vectored(&self, bufs: &mut [IoSlice<'_>]) -> Result<()> { ... }
fn write_vectored_at(
&self,
bufs: &[IoSlice<'_>],
offset: u64
) -> Result<usize> { ... }
fn write_all_vectored_at(
&self,
bufs: &mut [IoSlice<'_>],
offset: u64
) -> Result<()> { ... }
fn is_write_vectored_at(&self) -> bool { ... }
}Expand description
Extension trait for std::fs::File and cap_std::fs::File.
Required methods
fn advise(&self, offset: u64, len: u64, advice: Advice) -> Result<()>[src]
fn advise(&self, offset: u64, len: u64, advice: Advice) -> Result<()>[src]Announce the expected access pattern of the data at the given offset.
fn allocate(&self, offset: u64, len: u64) -> Result<()>[src]
fn allocate(&self, offset: u64, len: u64) -> Result<()>[src]Allocate space in the file, increasing the file size as needed, and ensuring that there are no holes under the given range.
fn read(&self, buf: &mut [u8]) -> Result<usize>[src]
fn read(&self, buf: &mut [u8]) -> Result<usize>[src]Pull some bytes from this source into the specified buffer, returning how many bytes were read.
This is similar to std::io::Read::read, except it takes self by
immutable reference since the entire side effect is I/O.
fn read_exact(&self, buf: &mut [u8]) -> Result<()>[src]
fn read_exact(&self, buf: &mut [u8]) -> Result<()>[src]Read the exact number of bytes required to fill buf.
This is similar to std::io::Read::read_exact, except it takes
self by immutable reference since the entire side effect is I/O.
fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize>[src]
fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize>[src]Reads a number of bytes starting from a given offset.
This is similar to std::os::unix::fs::FileExt::read_at, except it
takes self by immutable reference since the entire side effect is
I/O, and it’s supported on non-Unix platforms including Windows.
fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<()>[src]
fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<()>[src]Reads the exact number of byte required to fill buf from the given offset.
This is similar to std::os::unix::fs::FileExt::read_exact_at, except
it takes self by immutable reference since the entire side effect is
I/O, and it’s supported on non-Unix platforms including Windows.
fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]
fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]Like read, except that it reads into a slice of buffers.
This is similar to std::io::Read::read_vectored, except it takes
self by immutable reference since the entire side effect is I/O.
fn read_to_end(&self, buf: &mut Vec<u8>) -> Result<usize>[src]
fn read_to_end(&self, buf: &mut Vec<u8>) -> Result<usize>[src]Read all bytes until EOF in this source, placing them into buf.
This is similar to std::io::Read::read_to_end, except it takes
self by immutable reference since the entire side effect is I/O.
fn read_to_end_at(&self, buf: &mut Vec<u8>, offset: u64) -> Result<usize>[src]
fn read_to_end_at(&self, buf: &mut Vec<u8>, offset: u64) -> Result<usize>[src]Read all bytes, starting at offset, until EOF in this source, placing
them into buf.
fn read_to_string(&self, buf: &mut String) -> Result<usize>[src]
fn read_to_string(&self, buf: &mut String) -> Result<usize>[src]Read all bytes until EOF in this source, appending them to buf.
This is similar to std::io::Read::read_to_string, except it takes
self by immutable reference since the entire side effect is I/O.
fn read_to_string_at(&self, buf: &mut String, offset: u64) -> Result<usize>[src]
fn read_to_string_at(&self, buf: &mut String, offset: u64) -> Result<usize>[src]Read all bytes, starting at offset, until EOF in this source,
appending them to buf.
fn peek(&self, buf: &mut [u8]) -> Result<usize>[src]
fn peek(&self, buf: &mut [u8]) -> Result<usize>[src]Read bytes from the current position without advancing the current position.
fn write(&self, buf: &[u8]) -> Result<usize>[src]
fn write(&self, buf: &[u8]) -> Result<usize>[src]Write a buffer into this writer, returning how many bytes were written.
This is similar to std::io::Write::write, except it takes self by
immutable reference since the entire side effect is I/O.
fn write_all(&self, buf: &[u8]) -> Result<()>[src]
fn write_all(&self, buf: &[u8]) -> Result<()>[src]Attempts to write an entire buffer into this writer.
This is similar to std::io::Write::write_all, except it takes self
by immutable reference since the entire side effect is I/O.
fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize>[src]
fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize>[src]Writes a number of bytes starting from a given offset.
This is similar to std::os::unix::fs::FileExt::write_at, except it
takes self by immutable reference since the entire side effect is
I/O, and it’s supported on non-Unix platforms including Windows.
fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<()>[src]
fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<()>[src]Attempts to write an entire buffer starting from a given offset.
This is similar to std::os::unix::fs::FileExt::write_all_at, except
it takes self by immutable reference since the entire side effect is
I/O, and it’s supported on non-Unix platforms including Windows.
fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize>[src]
fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize>[src]Like write, except that it writes from a slice of buffers.
This is similar to std::io::Write::write_vectored, except it takes
self by immutable reference since the entire side effect is I/O.
fn write_fmt(&self, fmt: Arguments<'_>) -> Result<()>[src]
fn write_fmt(&self, fmt: Arguments<'_>) -> Result<()>[src]Writes a formatted string into this writer, returning any error encountered.
This is similar to std::io::Write::write_fmt, except it takes self by
immutable reference since the entire side effect is I/O.
fn flush(&self) -> Result<()>[src]
fn flush(&self) -> Result<()>[src]Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
This is similar to std::io::Write::flush, except it takes self by
immutable reference since the entire side effect is I/O.
fn seek(&self, pos: SeekFrom) -> Result<u64>[src]
fn seek(&self, pos: SeekFrom) -> Result<u64>[src]Seek to an offset, in bytes, in a stream.
This is similar to std::io::Seek::seek, except it takes self by
immutable reference since the entire side effect is I/O.
fn stream_position(&self) -> Result<u64>[src]
fn stream_position(&self) -> Result<u64>[src]Returns the current seek position from the start of the stream.
This is similar to std::io::Seek::stream_position, except it’s
available on Rust stable.
This may eventually be implemented by rust-lang/rust#62726.
Provided methods
fn read_exact_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<()>[src]
fn read_exact_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<()>[src]Is to read_vectored what read_exact is to read.
fn read_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<usize>[src]
fn read_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<usize>[src]Is to read_vectored what read_at is to read.
fn read_exact_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<()>[src]
fn read_exact_vectored_at(
&self,
bufs: &mut [IoSliceMut<'_>],
offset: u64
) -> Result<()>[src]Is to read_exact_vectored what read_exact_at is to read_exact.
fn is_read_vectored_at(&self) -> bool[src]
fn is_read_vectored_at(&self) -> bool[src]Determines if this Reader has an efficient read_vectored_at implementation.
Implementors
impl<T> FileIoExt for T where
T: AsUnsafeFile, [src]
impl<T> FileIoExt for T where
T: AsUnsafeFile, [src]Implement FileIoExt for any type which implements AsRawFd.