[−][src]Struct cap_std::fs::File
A reference to an open file on a filesystem.
This corresponds to std::fs::File
.
Note that this File
has no open
or create
methods. To open or create
a file, you must first obtain a Dir
containing the path, and then call
Dir::open_file
or Dir::create_file
.
Implementations
impl File
[src]
pub fn from_std(std: File) -> Self
[src]
Constructs a new instance of Self
from the given std::fs::File
.
pub fn sync_all(&self) -> Result<()>
[src]
Attempts to sync all OS-internal metadata to disk.
This corresponds to std::fs::File::sync_all
.
pub fn sync_data(&self) -> Result<()>
[src]
This function is similar to sync_all
, except that it may not synchronize
file metadata to a filesystem.
This corresponds to std::fs::File::sync_data
.
pub fn set_len(&self, size: u64) -> Result<()>
[src]
Truncates or extends the underlying file, updating the size of this file to become size.
This corresponds to std::fs::File::set_len
.
pub fn metadata(&self) -> Result<Metadata>
[src]
Queries metadata about the underlying file.
This corresponds to std::fs::File::metadata
.
pub fn try_clone(&self) -> Result<Self>
[src]
Creates a new File
instance that shares the same underlying file handle as the existing
File
instance.
This corresponds to std::fs::File::try_clone
.
Trait Implementations
impl AsRawFd for File
[src]
impl FileExt for File
[src]
fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize>
[src]
fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize>
[src]
fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<()>
[src]
fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<()>
[src]
impl From<File> for Stdio
[src]
impl FromRawFd for File
[src]
unsafe fn from_raw_fd(fd: RawFd) -> Self
[src]
impl IntoRawFd for File
[src]
fn into_raw_fd(self) -> RawFd
[src]
impl Read for File
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut]) -> Result<usize>
[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
[src]
fn is_read_vectored(&self) -> bool
[src]
unsafe fn initializer(&self) -> Initializer
[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
fn bytes(self) -> Bytes<Self>
1.0.0[src]
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
impl Seek for File
[src]
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
[src]
fn stream_len(&mut self) -> Result<u64, Error>
[src]
fn stream_position(&mut self) -> Result<u64, Error>
[src]
impl Write for File
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
fn flush(&mut self) -> Result<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize>
[src]
fn write_all(&mut self, buf: &[u8]) -> Result<()>
[src]
fn is_write_vectored(&self) -> bool
[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice]) -> Result<(), Error>
[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,