diff options
Diffstat (limited to 'src/indexes/mod.rs')
-rw-r--r-- | src/indexes/mod.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/indexes/mod.rs b/src/indexes/mod.rs new file mode 100644 index 0000000..1e83146 --- /dev/null +++ b/src/indexes/mod.rs @@ -0,0 +1,30 @@ +// Copyright 2021 Colin Finck <colin@reactos.org> +// SPDX-License-Identifier: GPL-2.0-or-later + +mod file_name; + +pub use file_name::*; + +use crate::error::Result; + +pub trait NtfsIndexEntryType { + type KeyType: NtfsIndexEntryKey; +} + +pub trait NtfsIndexEntryKey: Sized { + fn key_from_slice(slice: &[u8], position: u64) -> Result<Self>; +} + +/// Indicates that the index entry type has additional data. +// This would benefit from negative trait bounds, as this trait and `NtfsIndexEntryHasFileReference` are mutually exclusive! +pub trait NtfsIndexEntryHasData: NtfsIndexEntryType { + type DataType: NtfsIndexEntryData; +} + +pub trait NtfsIndexEntryData: Sized { + fn data_from_slice(slice: &[u8], position: u64) -> Result<Self>; +} + +/// Indicates that the index entry type has a file reference. +// This would benefit from negative trait bounds, as this trait and `NtfsIndexEntryHasData` are mutually exclusive! +pub trait NtfsIndexEntryHasFileReference: NtfsIndexEntryType {} |