Struct uefi::proto::media::file::Directory

source ·
pub struct Directory(/* private fields */);
Expand description

A FileHandle that is also a directory.

Use File::into_type or Directory::new to create a Directory. In addition to supporting the normal File operations, Directory supports iterating over its contained files.

Implementations§

source§

impl Directory

source

pub unsafe fn new(handle: FileHandle) -> Self

Coverts a FileHandle into a Directory without checking the file type.

§Safety

This function should only be called on files which ARE directories, doing otherwise is unsafe.

source

pub fn read_entry<'buf>( &mut self, buffer: &'buf mut [u8] ) -> Result<Option<&'buf mut FileInfo>, Option<usize>>

Read the next directory entry.

Try to read the next directory entry into buffer. If the buffer is too small, report the required buffer size as part of the error. If there are no more directory entries, return an empty optional.

The input buffer must be correctly aligned for a FileInfo. You can query the required alignment through the Align trait (<FileInfo as Align>::alignment()).

§Arguments
  • buffer The target buffer of the read operation
§Errors

All errors come from calls to RegularFile::read.

source

pub fn read_entry_boxed(&mut self) -> Result<Option<Box<FileInfo>>>

Available on crate feature alloc only.

Wrapper around Self::read_entry that returns an owned copy of the data. It has the same implications and requirements. On failure, the payload of Err is `()´.

source

pub fn read_entry_boxed_in<A: Allocator>( &mut self, allocator: A ) -> Result<Option<Box<FileInfo>>>

Available on crate features unstable and alloc only.

Wrapper around Self::read_entry that returns an owned copy of the data. It has the same implications and requirements. On failure, the payload of Err is `()´.

It allows to use a custom allocator via the allocator_api feature.

source

pub fn reset_entry_readout(&mut self) -> Result

Start over the process of enumerating directory entries

§Errors

All errors come from calls to RegularFile::set_position.

Trait Implementations§

source§

impl Debug for Directory

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl File for Directory

source§

fn is_regular_file(&self) -> Result<bool>

Returns if the underlying file is a regular file. The result is an error if the underlying file was already closed or deleted. Read more
source§

fn is_directory(&self) -> Result<bool>

Returns if the underlying file is a directory. The result is an error if the underlying file was already closed or deleted. Read more
source§

fn open( &mut self, filename: &CStr16, open_mode: FileMode, attributes: FileAttribute ) -> Result<FileHandle>

Try to open a file relative to this file. Read more
source§

fn close(self)

Close this file handle. Same as dropping this structure.
source§

fn delete(self) -> Result

Closes and deletes this file Read more
source§

fn get_info<'buf, Info: FileProtocolInfo + ?Sized>( &mut self, buffer: &'buf mut [u8] ) -> Result<&'buf mut Info, Option<usize>>

Queries some information about a file Read more
source§

fn set_info<Info: FileProtocolInfo + ?Sized>(&mut self, info: &Info) -> Result

Sets some information about a file Read more
source§

fn flush(&mut self) -> Result

Flushes all modified data associated with the file handle to the device Read more
source§

fn get_boxed_info<Info: FileProtocolInfo + ?Sized + Debug>( &mut self ) -> Result<Box<Info>>

Available on crate feature alloc only.
Read the dynamically allocated info for a file.
source§

fn get_boxed_info_in<Info: FileProtocolInfo + ?Sized + Debug, A: Allocator>( &mut self, allocator: A ) -> Result<Box<Info>>

Available on crate features unstable and alloc only.
Read the dynamically allocated info for a file.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.