Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/ntfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/attribute_value/mod.rs')
-rw-r--r--src/attribute_value/mod.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/attribute_value/mod.rs b/src/attribute_value/mod.rs
index 95c56ba..652ccdf 100644
--- a/src/attribute_value/mod.rs
+++ b/src/attribute_value/mod.rs
@@ -20,6 +20,7 @@ use crate::traits::NtfsReadSeek;
/// Reader that abstracts over all attribute value types, returned by [`NtfsAttribute::value`].
///
/// [`NtfsAttribute::value`]: crate::NtfsAttribute::value
+#[allow(clippy::large_enum_variant)]
#[derive(Clone, Debug)]
pub enum NtfsAttributeValue<'n, 'f> {
/// A resident attribute value (which is entirely contained in the NTFS File Record).
@@ -52,6 +53,11 @@ impl<'n, 'f> NtfsAttributeValue<'n, 'f> {
}
}
+ /// Returns `true` if the attribute value contains no data.
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
/// Returns the total length of the attribute value data, in bytes.
pub fn len(&self) -> u64 {
match self {
@@ -123,6 +129,11 @@ where
self.value
}
+ /// Returns `true` if the attribute value contains no data.
+ pub fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
/// Returns the total length of the attribute value, in bytes.
pub fn len(&self) -> u64 {
self.value.len()