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:
authorColin Finck <colin@reactos.org>2022-01-14 09:23:58 +0300
committerColin Finck <colin@reactos.org>2022-01-14 09:23:58 +0300
commitbbe333090d84745f99a7ee117baab3fa7d115b16 (patch)
treecfbcdad684cca6aef06792757b194d866cb48c35 /src/attribute_value/mod.rs
parent252a6467abbc57d67dbad4143d06f6d54660e769 (diff)
Apply suggestions from clippy.
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()