Pack
- file format 6
- Rust SDK 1.0 preview
Opening a pack and reading its parts. A Pack holds the whole file in one buffer, verified on open unless the options say otherwise.
On this page, Result<T> is std::result::Result<T, plxi_sdk::Error>.
Every public struct and enum with a public field or variant is marked #[non_exhaustive]: code outside the crate builds one through its constructors and matches an enum with a _ arm.
Structs
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct OpenOptions {
pub verify: bool,
pub max_input_bytes: Option<u64>,
}
impl Default for OpenOptions- Summary
How to open a pack.
The default verifies (spec §9 steps 1-8); a caller that must read a damaged pack opts out with
OpenOptions::no_verifyand accepts that records may come from a damaged body.- Fields
- Spec
- Spec §9
pub fn no_verify() -> Self- Summary
Open without verifying the digest, the header/footer agreement or the records. The framing checks the reader needs (size, header grammar, footer, layout) still run.
- Parameters
- None.
- Returns
Self- Example
- Example 2: Verify
- Spec
- Spec §9
pub fn with_max_input_bytes(self, n: u64) -> Self- Summary
Cap the input size (see
OpenOptions::max_input_bytes).- Parameters
n: u64
- Returns
Self- Spec
- Spec §9
pub fn with_verify(self, verify: bool) -> Self- Summary
Set whether to verify at open.
- Parameters
verify: bool
- Returns
Self- Example
- Example 1: Write and read
- Spec
- Spec §2
pub struct Pack { /* private fields */ }
impl Debug for Pack- Summary
A
.plxiv6 pack held in memory, in one 64-byte-aligned buffer the appendix reader shares without copying.- Example
- Example 1: Write and read
- Spec
- Spec §2
pub fn open(path: impl AsRef<Path>, opts: OpenOptions) -> Result<Pack>- Summary
Read and open the pack at
path(plain or.plxi.gz).- Parameters
path: impl AsRef<Path>opts: OpenOptions
- Returns
Result<Pack>- Errors
iowhen the file cannot be read; every kind offrom_bytes.- Spec
- Spec §9
pub fn from_bytes(bytes: Vec<u8>, opts: OpenOptions) -> Result<Pack>- Summary
Open a pack held in memory. Input that starts with the gzip magic is inflated first (spec §11). No file is read or written.
With
opts.verify(the default) the pack passes spec §9 steps 1-8 or the kind of the first failing step is returned.- Parameters
bytes: Vec<u8>opts: OpenOptions
- Returns
Result<Pack>- Errors
The kind of the first failing step;
limit_exceededovermax_input_bytes.- Example
- Example 1: Write and read
- Spec
- Spec §9
pub fn record_count(&self) -> u64- Summary
The footer's record count (the authoritative count, spec §10.0).
- Parameters
- None.
- Returns
u64- Example
- Example 1: Write and read
- Spec
- Spec §2
pub fn has_appendix(&self) -> bool- Summary
Whether the pack has an embedded CSDT appendix.
- Parameters
- None.
- Returns
bool- Example
- Example 1: Write and read
- Spec
- Spec §2
pub fn records(&self) -> impl Iterator<Item = Result<Record>> + '_- Summary
Iterate the records in file order.
A body that is not UTF-8, or whose appendix marker is misplaced, yields one error item and nothing else.
- Parameters
- None.
- Returns
impl Iterator<Item = Result<Record>> + '_- Example
- Example 1: Write and read
- Spec
- Spec §4
pub fn records_filtered<'a>(
&'a self,
filter: &'a Filter,
) -> impl Iterator<Item = Result<Record>> + 'a- Summary
Iterate the records
filterkeeps, in file order.- Parameters
filter: &'a Filter
- Returns
impl Iterator<Item = Result<Record>> + 'a- Example
- Example 3: Filter and views
- Spec
- Spec §5.3
pub fn appendix(&self) -> Result<Option<Appendix<'_>>>- Summary
The embedded CSDT appendix, opened over the pack's own buffer with no copy and no file.
Nonewhen the pack has no appendix.- Parameters
- None.
- Returns
Result<Option<Appendix<'_>>>- Errors
Appendix kinds from the container checks made when the appendix is opened (spec §9 step 9).
- Spec
- Spec §7
pub fn to_bytes(&self) -> &[u8]- Summary
The pack's bytes: the verified input, inflated when it was
.plxi.gz.- Parameters
- None.
- Returns
&[u8]- Spec
- Spec §11
pub fn body_bytes(&self) -> &[u8]- Summary
The record text bytes (offset 257 up to the text section end).
- Parameters
- None.
- Returns
&[u8]- Example
- Example 1: Write and read
- Spec
- Spec §2
pub fn sha256_hex(&self) -> String- Summary
The footer's SHA-256 digest as 64 lowercase hex digits.
- Parameters
- None.
- Returns
String- Example
- Example 1: Write and read
- Spec
- Spec §6
© 2020-2026 Cintile Inc. All Rights Reserved.
Anyone may implement this format. Copying or republishing the text of this specification requires permission from Cintile Inc.