Struct ntfs::NtfsAttribute
source · pub struct NtfsAttribute<'n, 'f> { /* private fields */ }
Expand description
A single NTFS Attribute of an NtfsFile
.
Not to be confused with NtfsFileAttributeFlags
.
This structure is returned by the NtfsAttributesRaw
iterator as well as NtfsAttributeItem::to_attribute
.
Reference: https://flatcap.github.io/linux-ntfs/ntfs/concepts/attribute_header.html
Implementations§
source§impl<'n, 'f> NtfsAttribute<'n, 'f>
impl<'n, 'f> NtfsAttribute<'n, 'f>
sourcepub fn attribute_length(&self) -> u32
pub fn attribute_length(&self) -> u32
Returns the length of this NTFS Attribute, in bytes.
This denotes the length of the attribute structure on disk. Apart from various headers, this structure also includes the name and, for resident attributes, the actual value.
sourcepub fn flags(&self) -> NtfsAttributeFlags
pub fn flags(&self) -> NtfsAttributeFlags
Returns flags set for this attribute as specified by NtfsAttributeFlags
.
sourcepub fn instance(&self) -> u16
pub fn instance(&self) -> u16
Returns the identifier of this attribute that is unique within the NtfsFile
.
sourcepub fn is_resident(&self) -> bool
pub fn is_resident(&self) -> bool
Returns true
if this is a resident attribute, i.e. one where its value
is part of the attribute structure.
sourcepub fn name(&self) -> Result<U16StrLe<'f>>
pub fn name(&self) -> Result<U16StrLe<'f>>
Gets the name of this NTFS Attribute (if any) and returns it wrapped in a U16StrLe
.
Note that most NTFS attributes have no name and are distinguished by their types.
Use NtfsAttribute::ty
to get the attribute type.
sourcepub fn name_length(&self) -> usize
pub fn name_length(&self) -> usize
Returns the length of the name of this NTFS Attribute, in bytes.
An attribute name has a maximum length of 255 UTF-16 code points (510 bytes).
It is always part of the attribute itself and hence also of the length
returned by NtfsAttribute::attribute_length
.
sourcepub fn position(&self) -> NtfsPosition
pub fn position(&self) -> NtfsPosition
Returns the absolute position of this NTFS Attribute within the filesystem, in bytes.
sourcepub fn resident_structured_value<S>(&self) -> Result<S>where
S: NtfsStructuredValueFromResidentAttributeValue<'n, 'f>,
pub fn resident_structured_value<S>(&self) -> Result<S>where S: NtfsStructuredValueFromResidentAttributeValue<'n, 'f>,
Attempts to parse the value data as the given resident structured value type and returns that.
This is a fast path for attributes that are always resident. It doesn’t need a reference to the filesystem reader.
This function first checks that the attribute is of the required type for that structured value and if it’s a resident attribute. It returns with an error if that is not the case. It also returns an error for any parsing problem.
sourcepub fn structured_value<T, S>(&self, fs: &mut T) -> Result<S>where
T: Read + Seek,
S: NtfsStructuredValue<'n, 'f>,
pub fn structured_value<T, S>(&self, fs: &mut T) -> Result<S>where T: Read + Seek, S: NtfsStructuredValue<'n, 'f>,
Attempts to parse the value data as the given structured value type and returns that.
This function first checks that the attribute is of the required type for that structured value. It returns with an error if that is not the case. It also returns an error for any parsing problem.
sourcepub fn ty(&self) -> Result<NtfsAttributeType>
pub fn ty(&self) -> Result<NtfsAttributeType>
Returns the type of this NTFS Attribute, or NtfsError::UnsupportedAttributeType
if it’s an unknown type.
sourcepub fn value<T>(&self, fs: &mut T) -> Result<NtfsAttributeValue<'n, 'f>>where
T: Read + Seek,
pub fn value<T>(&self, fs: &mut T) -> Result<NtfsAttributeValue<'n, 'f>>where T: Read + Seek,
Returns an NtfsAttributeValue
structure to read the value of this NTFS Attribute.
sourcepub fn value_length(&self) -> u64
pub fn value_length(&self) -> u64
Returns the length of the value data of this NTFS Attribute, in bytes.
Trait Implementations§
source§impl<'n, 'f> Clone for NtfsAttribute<'n, 'f>
impl<'n, 'f> Clone for NtfsAttribute<'n, 'f>
source§fn clone(&self) -> NtfsAttribute<'n, 'f>
fn clone(&self) -> NtfsAttribute<'n, 'f>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more