pub struct Volume<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize>where
D: BlockDevice,
T: TimeSource,{ /* private fields */ }
Expand description
An open volume on disk, which closes on drop.
In contrast to a RawVolume
, a Volume
holds a mutable reference to its
parent VolumeManager
, which restricts which operations you can perform.
If you drop a value of this type, it closes the volume automatically, but
any error that may occur will be ignored. To handle potential errors, use
the Volume::close
method.
Implementations§
Source§impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> Volume<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>where
D: BlockDevice,
T: TimeSource,
impl<'a, D, T, const MAX_DIRS: usize, const MAX_FILES: usize, const MAX_VOLUMES: usize> Volume<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>where
D: BlockDevice,
T: TimeSource,
Sourcepub fn new(
raw_volume: RawVolume,
volume_mgr: &'a mut VolumeManager<D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>,
) -> Volume<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>
pub fn new( raw_volume: RawVolume, volume_mgr: &'a mut VolumeManager<D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>, ) -> Volume<'a, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>
Create a new Volume
from a RawVolume
Sourcepub fn open_root_dir(
&mut self,
) -> Result<Directory<'_, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>, Error<D::Error>>
pub fn open_root_dir( &mut self, ) -> Result<Directory<'_, D, T, MAX_DIRS, MAX_FILES, MAX_VOLUMES>, Error<D::Error>>
Open the volume’s root directory.
You can then read the directory entries with iterate_dir
, or you can
use open_file_in_dir
.
Sourcepub fn to_raw_volume(self) -> RawVolume
pub fn to_raw_volume(self) -> RawVolume
Convert back to a raw volume
Sourcepub fn close(self) -> Result<(), Error<D::Error>>
pub fn close(self) -> Result<(), Error<D::Error>>
Consume the Volume
handle and close it. The behavior of this is similar
to using core::mem::drop
or letting the Volume
go out of scope,
except this lets the user handle any errors that may occur in the process,
whereas when using drop, any errors will be discarded silently.