[−][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
or Dir::create
.
Implementations
impl File
[src]
pub unsafe fn from_std(std: File) -> Self
[src]
Constructs a new instance of Self
from the given std::fs::File
.
Safety
std::fs::File
is not sandboxed and may access any path that the host
pub fn into_std(self) -> File
[src]
Consumes self
and returns a 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
.
pub fn set_permissions(&self, perm: Permissions) -> Result<()>
[src]
Changes the permissions on the underlying file.
This corresponds to std::fs::File::set_permissions
.
Trait Implementations
impl AsRawHandle for File
[src]
pub fn as_raw_handle(&self) -> RawHandle
[src]
impl Debug for File
[src]
impl FileExt for File
[src]
pub fn seek_read(&self, buf: &mut [u8], offset: u64) -> Result<usize>
[src]
pub fn seek_write(&self, buf: &[u8], offset: u64) -> Result<usize>
[src]
impl FromRawHandle for File
[src]
pub unsafe fn from_raw_handle(handle: RawHandle) -> Self
[src]
impl IntoRawHandle for File
[src]
pub fn into_raw_handle(self) -> RawHandle
[src]
impl Read for File
[src]
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
pub fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
[src]
pub fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
[src]
pub fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
[src]
pub fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
[src]
pub fn is_read_vectored(&self) -> bool
[src]
pub unsafe fn initializer(&self) -> Initializer
[src]
pub fn by_ref(&mut self) -> &mut Self
1.0.0[src]
pub fn bytes(self) -> Bytes<Self>
1.0.0[src]
pub fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
pub fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
impl Read for &File
[src]
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
pub fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
[src]
pub fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
[src]
pub fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
[src]
pub fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
[src]
pub fn is_read_vectored(&self) -> bool
[src]
pub unsafe fn initializer(&self) -> Initializer
[src]
pub fn by_ref(&mut self) -> &mut Self
1.0.0[src]
pub fn bytes(self) -> Bytes<Self>
1.0.0[src]
pub fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
pub fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
impl Seek for File
[src]
pub fn seek(&mut self, pos: SeekFrom) -> Result<u64>
[src]
pub fn stream_len(&mut self) -> Result<u64, Error>
[src]
pub fn stream_position(&mut self) -> Result<u64, Error>
[src]
impl Seek for &File
[src]
pub fn seek(&mut self, pos: SeekFrom) -> Result<u64>
[src]
pub fn stream_len(&mut self) -> Result<u64, Error>
[src]
pub fn stream_position(&mut self) -> Result<u64, Error>
[src]
impl Write for File
[src]
pub fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
pub fn flush(&mut self) -> Result<()>
[src]
pub fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>
[src]
pub fn write_all(&mut self, buf: &[u8]) -> Result<()>
[src]
pub fn is_write_vectored(&self) -> bool
[src]
pub fn write_all_vectored(
&mut self,
bufs: &mut [IoSlice<'_>]
) -> Result<(), Error>
[src]
&mut self,
bufs: &mut [IoSlice<'_>]
) -> Result<(), Error>
pub fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>
1.0.0[src]
pub fn by_ref(&mut self) -> &mut Self
1.0.0[src]
impl Write for &File
[src]
pub fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
pub fn flush(&mut self) -> Result<()>
[src]
pub fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>
[src]
pub fn write_all(&mut self, buf: &[u8]) -> Result<()>
[src]
pub fn is_write_vectored(&self) -> bool
[src]
pub fn write_all_vectored(
&mut self,
bufs: &mut [IoSlice<'_>]
) -> Result<(), Error>
[src]
&mut self,
bufs: &mut [IoSlice<'_>]
) -> Result<(), Error>
pub fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>
1.0.0[src]
pub fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for File
[src]
impl Send for File
[src]
impl Sync for File
[src]
impl Unpin for File
[src]
impl UnwindSafe for File
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsUnsafeFile for T where
T: AsRawHandle,
[src]
T: AsRawHandle,
pub fn as_unsafe_file(&self) -> UnsafeFile
[src]
pub fn as_file_view(&self) -> View<'_, File>
[src]
pub unsafe fn as_unscoped_file_view(&self) -> View<'static, File>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> FromUnsafeFile for T where
T: FromRawHandle,
[src]
T: FromRawHandle,
pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoUnsafeFile for T where
T: IntoRawHandle,
[src]
T: IntoRawHandle,
pub fn into_unsafe_file(self) -> UnsafeFile
[src]
pub fn into_file(self) -> File
[src]
impl<T> SetTimes for T where
T: AsRawHandle,
T: AsRawHandle,
pub fn set_times(
&self,
atime: Option<SystemTimeSpec>,
mtime: Option<SystemTimeSpec>
) -> Result<(), Error>
&self,
atime: Option<SystemTimeSpec>,
mtime: Option<SystemTimeSpec>
) -> Result<(), Error>
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.
pub 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>,