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]

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]

Consumes self and returns a std::fs::File.

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]

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 AsRawFd for File[src]

impl Debug for File[src]

impl FileExt for File[src]

impl FromRawFd for File[src]

impl IntoRawFd for File[src]

impl OwnsRaw for File[src]

impl Read for File[src]

impl Read for &File[src]

impl Seek for File[src]

impl Seek for &File[src]

impl Write for File[src]

impl Write 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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsUnsafeFile for T where
    T: AsRawFd + OwnsRaw
[src]

impl<T> AsUnsafeHandle for T where
    T: AsRawFd + OwnsRaw
[src]

impl<T> AsUnsafeSocket for T where
    T: AsRawFd + OwnsRaw
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FromUnsafeFile for T where
    T: FromRawFd + OwnsRaw
[src]

impl<T> FromUnsafeSocket for T where
    T: FromRawFd + OwnsRaw
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoUnsafeFile for T where
    T: IntoRawFd + OwnsRaw
[src]

impl<T> IntoUnsafeHandle for T where
    T: IntoRawFd + OwnsRaw
[src]

impl<T> IntoUnsafeSocket for T where
    T: IntoRawFd + OwnsRaw
[src]

impl<T> SetTimes for T where
    T: AsUnsafeFile

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.