pub struct FsKind(/* private fields */);Expand description
The filesystem family — the canonical identity newtype from
forensicnomicon-core (FsKind::NTFS, FsKind::EXT, …).
Canonical identity of a filesystem, content-addressed by a stable lowercase
name.
A newtype over &'static str (not an enum) so the set is open: adding a
filesystem is a new const here, never a breaking change to a downstream
contract crate. Every filesystem is a uniform const — none is a
first-class variant and none is a stringly-typed Other.
Intended as the single source of the identity that forensic-vfs::FsKind
re-exports, retiring its named-variants-plus-Other enum.
The names here are the canonical identity labels; they intentionally
differ from the human-facing detection names in FILESYSTEM_SIGNATURES
(e.g. identity ext vs. the signature label ext2/3/4). Identity and
detection are kept as two separate concerns; this type carries no magics.
Implementations§
Source§impl FsKind
impl FsKind
Sourcepub const UNKNOWN_FALLBACK: FsKind = FsKind::NTFS
pub const UNKNOWN_FALLBACK: FsKind = FsKind::NTFS
Documented fallback for a name outside known. A
runtime string cannot be promoted to a &'static str without leaking, so
deserializing an unrecognized name collapses to this single sentinel
(the first registered kind) rather than allocating or panicking. Callers
needing strict validation compare the input against
known before trusting a deserialized value.
Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
The stable lowercase identifier — round-trips, safe for logs / JSON / URIs.
Sourcepub const fn from_name(name: &'static str) -> FsKind
pub const fn from_name(name: &'static str) -> FsKind
Construct from a compile-time name. Returns a kind wrapping the given static string; pass one of the const names to get a registered kind.
Sourcepub fn known() -> &'static [FsKind]
pub fn known() -> &'static [FsKind]
All registered kinds — lets consumers enumerate/validate without a closed enum.
Not const fn: referencing a static from a const fn (const_refs_to_static)
only stabilized in Rust 1.83, and this crate’s MSRV is 1.75. A plain fn returning
the 'static slice works on every supported toolchain.