pub struct FileId { /* private fields */ }Expand description
The identity of a file: two paths whose identities are equal name one file.
DiskTree takes it from the verified handle: on Unix the device and
inode numbers, on Windows the path the system gives for the handle, below
the root. MemoryTree
uses the UTF-8 bytes of its normalised key. Another backend builds one with
FileId::from_device or FileId::from_key.
A composite tree scopes that same backend identity with FileId::in_source;
equal backend keys in different authorities are different files.
A device and inode pair names one file only where the file system keeps inode numbers unique and stable while the tree is read, as local file systems do; a file system that reuses or invents them (some network and user-space mounts) can make two files look like one.
Implementations§
Source§impl FileId
impl FileId
Sourcepub fn from_device(dev: u64, ino: u64) -> Self
pub fn from_device(dev: u64, ino: u64) -> Self
The identity of a file given by its device and inode numbers.
Sourcepub fn from_key(key: impl AsRef<[u8]>) -> Self
pub fn from_key(key: impl AsRef<[u8]>) -> Self
The identity of a file given by a key that names exactly one file of the backend, such as its normalised path or native path encoding.
Keys are compared byte for byte without a text conversion. Textual callers supply their UTF-8 bytes; native backends can preserve keys that are not valid UTF-8. The copied payload is shared by clones.
Sourcepub fn in_source(self, authority: SourceAuthorityId) -> Self
pub fn in_source(self, authority: SourceAuthorityId) -> Self
Explicitly scope the same backend identity to a selected source.
The underlying device/key identity stays intact, including aliases to one physical file. Cloning a byte-key identity shares its existing payload.
The source authority in which this backend identity is interpreted.
Trait Implementations§
impl Eq for FileId
Source§impl Ord for FileId
impl Ord for FileId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for FileId
impl PartialOrd for FileId
impl StructuralPartialEq for FileId
Auto Trait Implementations§
impl Forget for FileId
impl Freeze for FileId
impl Move for FileId
impl RefUnwindSafe for FileId
impl Send for FileId
impl Sync for FileId
impl Unpin for FileId
impl UnsafeUnpin for FileId
impl UnwindSafe for FileId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> EvidenceLease for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more