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/types.rs')
-rw-r--r--src/types.rs60
1 files changed, 33 insertions, 27 deletions
diff --git a/src/types.rs b/src/types.rs
index d327484..563f353 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -4,9 +4,24 @@
use crate::error::{NtfsError, Result};
use crate::ntfs::Ntfs;
use binread::BinRead;
-use core::fmt;
+use derive_more::{Binary, Display, From, LowerHex, Octal, UpperHex};
-#[derive(BinRead, Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
+#[derive(
+ Binary,
+ BinRead,
+ Clone,
+ Copy,
+ Debug,
+ Display,
+ Eq,
+ From,
+ LowerHex,
+ Octal,
+ Ord,
+ PartialEq,
+ PartialOrd,
+ UpperHex,
+)]
pub struct Lcn(u64);
impl Lcn {
@@ -27,19 +42,22 @@ impl Lcn {
}
}
-impl fmt::Display for Lcn {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(f, "{}", self.0)
- }
-}
-
-impl From<u64> for Lcn {
- fn from(value: u64) -> Self {
- Self(value)
- }
-}
-
-#[derive(BinRead, Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
+#[derive(
+ Binary,
+ BinRead,
+ Clone,
+ Copy,
+ Debug,
+ Display,
+ Eq,
+ From,
+ LowerHex,
+ Octal,
+ Ord,
+ PartialEq,
+ PartialOrd,
+ UpperHex,
+)]
pub struct Vcn(i64);
impl Vcn {
@@ -49,15 +67,3 @@ impl Vcn {
.ok_or(NtfsError::VcnTooBig { vcn: *self })
}
}
-
-impl fmt::Display for Vcn {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(f, "{}", self.0)
- }
-}
-
-impl From<i64> for Vcn {
- fn from(value: i64) -> Self {
- Self(value)
- }
-}