pub struct Header { /* private fields */ }Expand description
Bundle header containing format metadata.
The header is the first 17 bytes of a .wvb file:
| Magic (8) | Version (1) | Index Size (4) | Checksum (4) |
|---|
- Magic Number:
0xf09f8c90f09f8e81(๐๐ in UTF-8) - Version: Bundle format version (currently 0x01)
- Index Size: Size of the index section in bytes (u32, big-endian)
- Checksum: xxHash-32 checksum of the header data
ยงExample
use wvb::{Header, Version};
let header = Header::new(Version::V1, 1024);
assert_eq!(header.version(), Version::V1);
assert_eq!(header.index_size(), 1024);Implementationsยง
Sourceยงimpl Header
impl Header
Sourcepub const MAGIC_LEN: usize = 8
pub const MAGIC_LEN: usize = 8
Length of the magic number in bytes (8 bytes for โ๐๐โ)
Sourcepub const MAGIC_OFFSET: u64 = 0
pub const MAGIC_OFFSET: u64 = 0
Offset of the magic number in the file
Sourcepub const VERSION_OFFSET: u64
pub const VERSION_OFFSET: u64
Offset of the version byte
Sourcepub const INDEX_SIZE_OFFSET: u64
pub const INDEX_SIZE_OFFSET: u64
Offset of the index size field
Sourcepub const INDEX_SIZE_BYTES_LEN: usize = 4
pub const INDEX_SIZE_BYTES_LEN: usize = 4
Length of the index size field in bytes
Sourcepub const CHECKSUM_OFFSET: u64
pub const CHECKSUM_OFFSET: u64
Offset of the header checksum
Sourcepub const END_OFFSET: u64
pub const END_OFFSET: u64
Total size of the header in bytes (17 bytes)
Sourcepub fn index_end_offset(&self) -> u64
pub fn index_end_offset(&self) -> u64
Calculates the byte offset where the index section ends.
This is the starting point of the data section.
Sourcepub fn new(version: Version, index_size: u32) -> Self
pub fn new(version: Version, index_size: u32) -> Self
Creates a new header.
ยงArguments
version- Bundle format versionindex_size- Size of the index section in bytes
Sourcepub fn index_size(&self) -> u32
pub fn index_size(&self) -> u32
Returns the size of the index section in bytes.
Trait Implementationsยง
impl Copy for Header
impl StructuralPartialEq for Header
Auto Trait Implementationsยง
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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
Mutably borrows from an owned value. Read more