Struct cap_std::fs::File [−][src]
pub struct File { /* fields omitted */ }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]
impl File[src]pub unsafe fn from_std(std: File) -> Self[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 process has access to.
pub fn into_std(self) -> File[src]
pub fn into_std(self) -> File[src]Consumes self and returns a std::fs::File.
pub fn with_options() -> OpenOptions[src]
pub fn with_options() -> OpenOptions[src]Returns a new OpenOptions object.
This corresponds to std::fs::File::with_options.
pub fn sync_all(&self) -> Result<()>[src]
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]
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]
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]
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]
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]
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]
impl AsRawHandle for File[src]fn as_raw_handle(&self) -> RawHandle[src]
fn as_raw_handle(&self) -> RawHandle[src]Extracts the raw handle, without taking any ownership.
impl AsRawHandleOrSocket for File[src]
impl AsRawHandleOrSocket for File[src]fn as_raw_handle_or_socket(&self) -> RawHandleOrSocket[src]
fn as_raw_handle_or_socket(&self) -> RawHandleOrSocket[src]Like AsRawHandle::as_raw_handle and AsRawSocket::as_raw_socket
but can return either type. Read more
impl FromRawHandle for File[src]
impl FromRawHandle for File[src]unsafe fn from_raw_handle(handle: RawHandle) -> Self[src]
unsafe fn from_raw_handle(handle: RawHandle) -> Self[src]Constructs a new I/O object from the specified raw handle. Read more
impl IntoRawHandle for File[src]
impl IntoRawHandle for File[src]fn into_raw_handle(self) -> RawHandle[src]
fn into_raw_handle(self) -> RawHandle[src]Consumes this object, returning the raw underlying handle. Read more
impl IntoRawHandleOrSocket for File[src]
impl IntoRawHandleOrSocket for File[src]fn into_raw_handle_or_socket(self) -> RawHandleOrSocket[src]
fn into_raw_handle_or_socket(self) -> RawHandleOrSocket[src]Like IntoRawHandle::into_raw_handle and
IntoRawSocket::into_raw_socket but can return either type. Read more
impl Read for File[src]
impl Read for File[src]fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]Like read, except that it reads into a slice of buffers. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>[src]Read the exact number of bytes required to fill buf. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>[src]Read all bytes until EOF in this source, placing them into buf. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]Read all bytes until EOF in this source, appending them to buf. Read more
fn is_read_vectored(&self) -> bool[src]
fn is_read_vectored(&self) -> bool[src]can_vector)Determines if this Reader has an efficient read_vectored
implementation. Read more
unsafe fn initializer(&self) -> Initializer[src]
unsafe fn initializer(&self) -> Initializer[src]read_initializer)Determines if this Reader can work with buffers of uninitialized
memory. Read more
fn by_ref(&mut self) -> &mut Self1.0.0[src]
fn by_ref(&mut self) -> &mut Self1.0.0[src]Creates a “by reference” adaptor for this instance of Read. Read more
impl Read for &File[src]
impl Read for &File[src]fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>[src]Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>[src]Like read, except that it reads into a slice of buffers. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>[src]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>[src]Read the exact number of bytes required to fill buf. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>[src]
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>[src]Read all bytes until EOF in this source, placing them into buf. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]Read all bytes until EOF in this source, appending them to buf. Read more
fn is_read_vectored(&self) -> bool[src]
fn is_read_vectored(&self) -> bool[src]can_vector)Determines if this Reader has an efficient read_vectored
implementation. Read more
unsafe fn initializer(&self) -> Initializer[src]
unsafe fn initializer(&self) -> Initializer[src]read_initializer)Determines if this Reader can work with buffers of uninitialized
memory. Read more
fn by_ref(&mut self) -> &mut Self1.0.0[src]
fn by_ref(&mut self) -> &mut Self1.0.0[src]Creates a “by reference” adaptor for this instance of Read. Read more
impl Seek for File[src]
impl Seek for File[src]impl Seek for &File[src]
impl Seek for &File[src]impl Write for File[src]
impl Write for File[src]fn write(&mut self, buf: &[u8]) -> Result<usize>[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>[src]Write a buffer into this writer, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>[src]
fn flush(&mut self) -> Result<()>[src]Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<()>[src]
fn write_all(&mut self, buf: &[u8]) -> Result<()>[src]Attempts to write an entire buffer into this writer. Read more
fn is_write_vectored(&self) -> bool[src]
fn is_write_vectored(&self) -> bool[src]can_vector)Determines if this Writer has an efficient write_vectored
implementation. Read more
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]write_all_vectored)Attempts to write multiple buffers into this writer. Read more
impl Write for &File[src]
impl Write for &File[src]fn write(&mut self, buf: &[u8]) -> Result<usize>[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>[src]Write a buffer into this writer, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>[src]
fn flush(&mut self) -> Result<()>[src]Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<()>[src]
fn write_all(&mut self, buf: &[u8]) -> Result<()>[src]Attempts to write an entire buffer into this writer. Read more
fn is_write_vectored(&self) -> bool[src]
fn is_write_vectored(&self) -> bool[src]can_vector)Determines if this Writer has an efficient write_vectored
implementation. Read more
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>[src]write_all_vectored)Attempts to write multiple buffers into this writer. Read more
impl OwnsRaw for File[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> AsUnsafeFile for T where
T: AsRawHandle + AsUnsafeHandle + OwnsRaw, [src]
impl<T> AsUnsafeFile for T where
T: AsRawHandle + AsUnsafeHandle + OwnsRaw, [src]pub fn as_unsafe_file(&self) -> UnsafeFile[src]
pub fn as_unsafe_file(&self) -> UnsafeFile[src]Return the contained unsafe file.
fn as_file_view(&self) -> View<'_, File>[src]
fn as_file_view(&self) -> View<'_, File>[src]Utility for returning a value which dereferences to a &File or
&mut File. Read more
unsafe fn as_unscoped_file_view(&self) -> View<'static, File>[src]
unsafe fn as_unscoped_file_view(&self) -> View<'static, File>[src]Like as_file_view, but returns a value which is not explicitly tied
to the lifetime of self. Read more
impl<T> AsUnsafeHandle for T where
T: AsRawHandleOrSocket + OwnsRaw, [src]
impl<T> AsUnsafeHandle for T where
T: AsRawHandleOrSocket + OwnsRaw, [src]pub fn as_unsafe_handle(&self) -> UnsafeHandle[src]
pub fn as_unsafe_handle(&self) -> UnsafeHandle[src]Return the contained unsafe handle.
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> FromUnsafeFile for T where
T: FromRawHandle + OwnsRaw, [src]
impl<T> FromUnsafeFile for T where
T: FromRawHandle + OwnsRaw, [src]pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T[src]
pub unsafe fn from_unsafe_file(unsafe_file: UnsafeFile) -> T[src]Convert an unsafe file into a Self. Read more
fn from_filelike<Filelike>(filelike: Filelike) -> Self where
Filelike: IntoUnsafeFile, [src]
fn from_filelike<Filelike>(filelike: Filelike) -> Self where
Filelike: IntoUnsafeFile, [src]Convert from a type which implements IntoUnsafeFile into a type that
implements FromUnsafeFile. Read more
impl<T> IntoUnsafeFile for T where
T: IntoRawHandle + IntoUnsafeHandle + OwnsRaw, [src]
impl<T> IntoUnsafeFile for T where
T: IntoRawHandle + IntoUnsafeHandle + OwnsRaw, [src]pub fn into_unsafe_file(self) -> UnsafeFile[src]
pub fn into_unsafe_file(self) -> UnsafeFile[src]Convert self into an unsafe file.
impl<T> IntoUnsafeHandle for T where
T: IntoRawHandleOrSocket + OwnsRaw, [src]
impl<T> IntoUnsafeHandle for T where
T: IntoRawHandleOrSocket + OwnsRaw, [src]pub fn into_unsafe_handle(self) -> UnsafeHandle[src]
pub fn into_unsafe_handle(self) -> UnsafeHandle[src]Convert self into an unsafe handle.
impl<T> SetTimes for T where
T: AsUnsafeFile,
impl<T> SetTimes for T where
T: AsUnsafeFile,