pub struct Attribute {
pub type_code: u32,
pub length: u32,
pub non_resident: bool,
pub name: Option<String>,
pub flags: u16,
pub attribute_id: u16,
pub offset: usize,
pub body: AttributeBody,
}Expand description
A parsed MFT attribute (common header + body discriminant).
Fields§
§type_code: u32Attribute type code (e.g. 0x80 for $DATA).
length: u32Total on-disk length of this attribute, including its header.
non_resident: booltrue when the value is stored out-of-line via a runlist.
name: Option<String>Decoded attribute name (e.g. an ADS stream name), or None when unnamed.
flags: u16Attribute flags (compressed / encrypted / sparse).
attribute_id: u16Attribute id, unique within the record.
offset: usizeByte offset of this attribute within the record.
body: AttributeBodyResident or non-resident body.
Implementations§
Source§impl Attribute
impl Attribute
Sourcepub fn is_compressed(&self) -> bool
pub fn is_compressed(&self) -> bool
true if the attribute is compressed.
Sourcepub fn compression_unit(&self) -> u16
pub fn compression_unit(&self) -> u16
The compression-unit size as a power of two clusters (NTFS 2^n; 0
means no compression unit / resident). A compressed $DATA stores its
data in 2^compression_unit-cluster units.
Sourcepub fn is_encrypted(&self) -> bool
pub fn is_encrypted(&self) -> bool
true if the attribute is encrypted (EFS).
Sourcepub fn type_name(&self) -> Option<&'static str>
pub fn type_name(&self) -> Option<&'static str>
Canonical $NAME of this attribute type, if known.
Sourcepub fn resident_content<'a>(&self, record: &'a [u8]) -> Option<&'a [u8]>
pub fn resident_content<'a>(&self, record: &'a [u8]) -> Option<&'a [u8]>
For a resident attribute, its value bytes within record. Returns None
for non-resident attributes or if the slice is out of bounds.