pub struct FsEntry<'a> {
    pub fs_type: FsEntryType,
    pub text: Cow<'a, str>,
    pub offset_start: u64,
    pub offset_end: u64,
}
Expand description

Directory or file entry, parsed without any allocation

Fields

fs_type: FsEntryType

If the FsEntryType == Dir, then offset_start..offset_end points to the start / end bytes of the next directory level, relative to the file header

If the FsEntryType = File, then offset_start..offset_end points to the actual file contents in the volume.data field

Inside of a directory level, all files are grouped by the name of the parent directory, at parsing time only the top-level directories are parsed

text: Cow<'a, str>

Directory / file name, for example usr, lib or var in "/usr/lib/var"

offset_start: u64offset_end: u64

Implementations

Returns the length of the file in bytes (0 for directories)

Serializes a list of FsEntry into bytes (usually done to encode one directory level)

Binary format
[8 bytes]: size of the directory level itself

[
  [1 byte]:  file entry type (0 = Directory, 1 = File, .. ?)
  [7 bytes]: text length N (only 7 bytes long instead of 8, maximum file
             name length = 268435456 instead of 4294967296 bytes)
  [8 bytes]: offset_start
  [8 bytes]: offset_end
  [n bytes]: text (directory / file name)
]

Reverse function of Self::into_bytes, parses one directory level from a set of bytes. One additional feature is that not more than n bytes are parsed if n is the size of the serialized directory level, even if the input buffer is larger than n.

If the directory level could not be parsed, the parsing is interrupted and the given file entries are returns as-is (no check for completeness)

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.