Struct sgx_tstd::untrusted::fs::File[][src]

pub struct File { /* fields omitted */ }

A reference to an open file on the filesystem.

An instance of a File can be read and/or written depending on what options it was opened with. Files also implement [Seek] to alter the logical cursor that the file contains internally.

Files are automatically closed when they go out of scope.

Methods

impl File
[src]

Attempts to open a file in read-only mode.

Opens a file in write-only mode.

This function will create a file if it does not exist, and will truncate it if it does.

Attempts to sync all OS-internal metadata to disk.

This function will attempt to ensure that all in-core data reaches the filesystem before returning.

This function is similar to sync_all, except that it may not synchronize file metadata to the filesystem.

This is intended for use cases that must synchronize content, but don't need the metadata on disk. The goal of this method is to reduce disk operations.

Note that some platforms may simply implement this in terms of sync_all.

Truncates or extends the underlying file, updating the size of this file to become size.

If the size is less than the current file's size, then the file will be shrunk. If it is greater than the current file's size, then the file will be extended to size and have all of the intermediate data filled in with 0s.

The file's cursor isn't changed. In particular, if the cursor was at the end and the file is shrunk using this operation, the cursor will now be past the end.

Errors

This function will return an error if the file is not opened for writing.

Queries metadata about the underlying file.

Create a new File instance that shares the same underlying file handle as the existing File instance. Reads, writes, and seeks will affect both File instances simultaneously.

Changes the permissions on the underlying file.

Platform-specific behavior

This function currently corresponds to the fchmod function on Unix and the SetFileInformationByHandle function on Windows. Note that, this may change in the future.

Errors

This function will return an error if the user lacks permission change attributes on the underlying file. It may also return an error in other os-specific unspecified cases.

Trait Implementations

impl AsRawFd for File
[src]

Extracts the raw file descriptor. Read more

impl FromRawFd for File
[src]

Constructs a new instance of Self from the given raw file descriptor. Read more

impl IntoRawFd for File
[src]

Consumes this object, returning the raw underlying file descriptor. Read more

impl FileExt for File
[src]

Reads a number of bytes starting from a given offset. Read more

Writes a number of bytes starting from a given offset. Read more

impl Debug for File
[src]

Formats the value using the given formatter. Read more

impl Read for File
[src]

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Determines if this Reader can work with buffers of uninitialized memory. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, appending them to buf. Read more

Read the exact number of bytes required to fill buf. Read more

Creates a "by reference" adaptor for this instance of Read. Read more

Important traits for Bytes<R>

Transforms this Read instance to an Iterator over its bytes. Read more

Important traits for Chars<R>

Transforms this Read instance to an Iterator over chars. Read more

Creates an adaptor which will chain this stream with another. Read more

Creates an adaptor which will read at most limit bytes from it. Read more

impl Write for File
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more

impl Seek for File
[src]

Seek to an offset, in bytes, in a stream. Read more

impl<'a> Read for &'a File
[src]

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Determines if this Reader can work with buffers of uninitialized memory. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, appending them to buf. Read more

Read the exact number of bytes required to fill buf. Read more

Creates a "by reference" adaptor for this instance of Read. Read more

Important traits for Bytes<R>

Transforms this Read instance to an Iterator over its bytes. Read more

Important traits for Chars<R>

Transforms this Read instance to an Iterator over chars. Read more

Creates an adaptor which will chain this stream with another. Read more

Creates an adaptor which will read at most limit bytes from it. Read more

impl<'a> Write for &'a File
[src]

Write a buffer into this object, returning how many bytes were written. Read more

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more

impl<'a> Seek for &'a File
[src]

Seek to an offset, in bytes, in a stream. Read more

Auto Trait Implementations

impl Send for File

impl Sync for File