#[non_exhaustive]#[repr(u8)]pub enum Tag {
Manifest = 1,
Index = 2,
Atoms = 3,
Volume = 4,
ChecksumNone = 20,
ChecksumSha256 = 21,
SignatureNone = 22,
Directory = 30,
File = 31,
}
v2
only.Expand description
Unique identifiers used to indicate various components of a WEBC file.
§Top-Level Sections
In general, all top-level sections are Type-Length-Value encoded.
Tag
(u8
)- Length (
u64
LE) - Value (
Length
bytes)
§Versioning
Besides acting as an identifier for various elements in a WEBC file, the
Tag
plays an important part in versioning. An item’s layout is tied
to its Tag
, so any time the layout is changed, a new unique Tag
should be created.
For example, if the format for a volume needs to be changed, a new
Tag::VolumeV2
variant would be added instead of modifying the spec for
existing volumes. Future reader implementations then need to handle
Tag::Volume
and Tag::VolumeV2
gracefully.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Manifest = 1
The manifest section, containing a CBOR-serialized
crate::metadata::Manifest
.
Index = 2
The index section, containing a CBOR-serialized crate::v2::Index
.
The index section is laid out as follows:
Tag::Index
- overall section length (
u64
LE) - CBOR data
- padding
§Note to Implementors
This section may contain trailing padding bytes that should be ignored when deserializing the index.
Depending on the writer implementation, padding bytes may be necessary
because the crate::v2::Index
needs to be at the start of a WEBC file,
yet it can only be calculated after everything has been serialized.
Atoms = 3
The atoms section.
An atoms section is laid out similar to Tag::Volume
.
Tag::Atoms
- overall section length (
u64
LE) - volume header length (
u64
LE) - volume header
- volume data length (
u64
LE) - volume data
Volume = 4
The volume section.
A volume section is laid out similar to Tag::Atoms
.
Tag::Volume
- overall section length
- volume name length (
u64
LE) - volume name (
u64
LE) - volume header length (
u64
LE) - volume header
- volume data length (
u64
LE) - volume data
ChecksumNone = 20
A tag for the empty checksum (i.e. crate::v2::Checksum::none()
).
ChecksumSha256 = 21
A tag indicating that the crate::v2::Checksum
is calculated using the
SHA-256 hash of a section’s contents.
See also, crate::v2::Checksum::sha256()
.
SignatureNone = 22
A tag for the empty signature (i.e. crate::v2::Signature::none()
).
Directory = 30
Metadata for a directory in the Tag::Volume
header.
Each directory follows the type-length-value format.
Tag::Directory
- overall directory length (
u64
LE) - zero or more entries
Where each entry is
- offset of the entry relative to the start of the header (
u64
LE) - name length (
u64
LE) - name (arbitrary number of bytes)
File = 31
Metadata for a file in the Tag::Volume
header.
File metadata follows the following format:
Tag::File
- start offset in data section (
u64
LE) - end offset in data section (
u64
LE) - SHA256 checksum (32 bytes)
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Tag
impl<'de> Deserialize<'de> for Tag
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Copy for Tag
impl Eq for Tag
impl StructuralPartialEq for Tag
Auto Trait Implementations§
impl Freeze for Tag
impl RefUnwindSafe for Tag
impl Send for Tag
impl Sync for Tag
impl Unpin for Tag
impl UnwindSafe for Tag
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<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
key
and return true
if they are equal.