pub struct VolumeIdentity { /* private fields */ }Expand description
A directory’s volume-level identity (D-78): the volume serial number,
plus the filesystem name and volume label kept only as descriptive data
for crate::Notification::VolumeChanged. Compared only when a
path-based reopen fallback succeeds (M11.3) – a ReOpenFile success is
structurally guaranteed to still be on the same volume – to notice
removable media swapped for different media mounted at the same path.
Equality (and therefore change detection) is on volume_serial alone
(PR #20 review response): the filesystem name and volume label are both
mutable (a volume can be relabeled without becoming different media, and
two different volumes can share a label and filesystem type), so neither
is a sound identity signal – comparing them would miss a genuine media
swap that happens to share the old label, and would falsely report a
change on a mere rename. DirectoryId’s own volume serial is not reused
here because it is read from a directory handle rather than this
volume-level query, and keeping the two independent avoids coupling this
type’s meaning to DirectoryId’s.
Implementations§
Source§impl VolumeIdentity
impl VolumeIdentity
Sourcepub fn filesystem_name(&self) -> String
pub fn filesystem_name(&self) -> String
The volume’s filesystem name (e.g. "NTFS", "FAT32", "ReFS"),
lossily – for display and logging, not for round-tripping.
Sourcepub fn volume_label(&self) -> String
pub fn volume_label(&self) -> String
The volume’s label, lossily – for display and logging, not for round-tripping.
Sourcepub fn for_test(
volume_serial: u32,
filesystem_name: &str,
volume_label: &str,
) -> Self
pub fn for_test( volume_serial: u32, filesystem_name: &str, volume_label: &str, ) -> Self
Consumer test-surface constructor (D-82), available only under the
off-by-default test-util feature. Builds a VolumeIdentity for a
downstream consumer synthesizing a
VolumeChanged notification to
feed its own handler; in production a VolumeIdentity only ever comes
from reading a real volume. Volume identity compares by serial alone, so
volume_serial is what decides whether two identities match; the
filesystem name and label are for display (D-83: valid by construction).