pub struct Volume<D: BlockDevice> { /* private fields */ }Expand description
A mounted volume. The filesystem type is detected from the boot sector, so callers use one API for FAT32 and exFAT cards.
Implementations§
Source§impl<D: BlockDevice> Volume<D>
impl<D: BlockDevice> Volume<D>
Sourcepub fn mount(device: D) -> impl Future<Output = Result<Self, Error<D::Error>>>
pub fn mount(device: D) -> impl Future<Output = Result<Self, Error<D::Error>>>
Mounts the volume on device, detecting FAT32 or exFAT from the boot sector at block 0 or in the first partition of
an MBR. Fails with Error::FilesystemNotEnabled if the card holds a filesystem whose feature is off.
The returned future holds device once, and the detection work borrows it. (An async fn would hold two copies of
an argument, which for a card of a few kilobytes is the larger part of the future.)
Sourcepub fn into_device(self) -> D
pub fn into_device(self) -> D
The device, when the volume is no longer wanted.
Sourcepub async fn open_file(&mut self, path: &str) -> Result<File, Error<D::Error>>
pub async fn open_file(&mut self, path: &str) -> Result<File, Error<D::Error>>
Opens the file at path: names separated by /, matched ignoring ASCII case. A leading / is allowed.
Sourcepub async fn open_dir(
&mut self,
path: &str,
) -> Result<Directory, Error<D::Error>>
pub async fn open_dir( &mut self, path: &str, ) -> Result<Directory, Error<D::Error>>
Opens the directory at path, as for open_file.
Sourcepub async fn next_entry(
&mut self,
dir: &mut Directory,
) -> Result<Option<DirEntry>, Error<D::Error>>
pub async fn next_entry( &mut self, dir: &mut Directory, ) -> Result<Option<DirEntry>, Error<D::Error>>
The next entry of dir, or None at the end. Entries come in directory order; . and .. are skipped.