Struct tartan_uefi::proto::File

source ·
#[repr(C)]
pub struct File { pub revision: u64, /* private fields */ }
Expand description

Protocol for accessing a file or directory.

Fields§

§revision: u64

Implemented revision of the File protocol.

Implementations§

Minimum supported SimpleFileSystem::revision. Future versions are guaranteed to be backwards-compatible.

Get a handle to a new file, relative to the directory represented by the current instance.

path uses the Windows path format without a drive name, e.g. \FOO\BAR.TXT or ..\QUUX.DAT.

attributes is only used if the file is created.

Errors

This method can fail for many reasons, including standard I/O issues like device errors or resource exhaustion. It can also fail if access is denied or there was an attempt to write to read-only media.

Panics

Panics if path is empty or does not end in a null character.

Flush and close the file or directory represented by the current instance.

Panics

Panics if the firmware does not behave according to the spec.

Delete the file or directory represented by the current instance.

Errors

This method cannot fail with an error, but it will return Status::WarnDeleteFailure if the file could not be deleted.

Read file contents or a directory entry into the buffer.

If this is a file, it will read up to buffer.len() bytes. If it is a directory, it will read a single directory entry if that entry can fit in the buffer.

On success, returns the number of bytes actually read.

Errors

This method can fail for many reasons, including standard I/O issues like device errors or resource exhaustion. In addition, it will return:

Write the contents of buffer out to the current position.

On success, returns the number of bytes actually written, which will always be the full buffer.

Errors

This method can fail for many reasons, including standard I/O issues like device errors or resource exhaustion. It addition, it will return:

  • Status::Unsupported if this is a directory.
  • Status::AccessDenied if the file is in read-only mode.

Get the handle’s current position in the file.

Errors

This function will fail with:

Set the handle’s current position in the file.

If the position is u64::MAX, this will seek to the end of the file. Otherwise, it seeks to the absolute position in bytes. If the position is greater than the current file size, the file will grow to the given size.

Errors

This function will fail with:

Write any buffered changes.

Errors

This method can fail for many reasons, including standard I/O issues like device errors or resource exhaustion. It can also fail if access is denied or there was an attempt to write to read-only media.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.