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

mod.rs « indexes « src - github.com/windirstat/ntfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ba3508cf8aabdff4229c9448a7c8f9048cf6bf6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 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;
use core::fmt;

pub trait NtfsIndexEntryType: fmt::Debug {
    type KeyType: NtfsIndexEntryKey;
}

pub trait NtfsIndexEntryKey: fmt::Debug + 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: fmt::Debug + 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 {}