Verify
- file format 6
- Rust SDK 1.0 preview
Checking a pack and reporting what was checked, and binding entities to their embedding rows. verify reports; it raises only when a step cannot be read.
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.
Figure 1 What verify does with each step
- Appendixonly with an appendixReported in
appendix; raised when the appendix cannot be opened - BindingsReported in
embrefs
Pack::verify reports a failure the pack can still be read past in a member of VerifyReport, and raises a failure that makes the pack unreadable as an error. A pack that fails step 4, 6 or 8 opens only with OpenOptions::no_verify(). Table 1 lists the same steps.| Step | Name | Result |
|---|---|---|
| 1 | Size | Raised as an error |
| 2 | Header | Raised as an error |
| 3 | Footer | Raised as an error |
| 4 | Header against footer | Reported in header_footer_agree |
| 5 | Layout | Raised as an error |
| 6 | Digest | Reported in sha256_ok |
| 7 | Body | Raised as an error |
| 8 | Count | Reported in record_count |
| 9 | Appendix | Reported in appendix; raised when the appendix cannot be opened |
| 10 | Bindings | Reported in embrefs |
Methods on Pack
pub fn verify(&self) -> Result<VerifyReport>- Summary
Run the verify algorithm (spec §9) and report.
Failures the report has a member for are reported, not raised: the digest, header/footer agreement, the record count, the footer's appendix checksum copy, per-section CRCs and binding counts. Failures that make the pack unreadable (steps 1-3, 5, 7, and an appendix the CSDT reader refuses at open) are raised with their kind.
- Parameters
- None.
- Returns
Result<VerifyReport>- Errors
The kind of an unreadable step, as above.
- Example
- Example 2: Verify
- Spec
- Spec §9
pub fn bind_embrefs(&self, profile: BindProfile) -> Result<Vec<BoundEmbedding>>- Summary
Bind every
embreftarget underprofile(spec §9 step 10).Returns one
BoundEmbeddingperembrefrecord, in record order.- Parameters
profile: BindProfile
- Returns
Result<Vec<BoundEmbedding>>- Errors
dangling_embreffor the first target that does not resolve (including anylocaltarget in a pack with no appendix);section_type_mismatchfor the first resolved target that is not a Compact section;unsupportedfor anexttarget, whose bytes live in another file; appendix kinds from opening the appendix or reading a section.- Spec
- Spec §5.4
Structs
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct RecordCountReport {
pub declared: u64,
pub actual: u64,
}- Summary
record_countin aVerifyReport.- Fields
declared: u64The footer'srecord_count.actual: u64Record lines actually present.
- Example
- Example 2: Verify
- Spec
- Spec §9
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct SectionCrcReport {
pub index: usize,
pub section_type: u16,
pub crc_ok: bool,
}- Summary
One appendix section's CRC result.
- Fields
index: usizeSection index.section_type: u16Section type code (spec §9 step 10).crc_ok: boolWhether the section data's CRC32C equals its descriptor's.
- Example
- Example 2: Verify
- Spec
- Spec §9
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AppendixReport {
pub present: bool,
pub file_checksum_ok: bool,
pub sections: Vec<SectionCrcReport>,
}- Summary
appendixin aVerifyReport.- Fields
present: boolWhether the pack has an appendix.file_checksum_ok: boolWhether the footer'scsdt_file_checksumequals the container'sfile_checksum(with no appendix: whether the footer copy is 0).sections: Vec<SectionCrcReport>Per-section CRC results.
- Example
- Example 2: Verify
- Spec
- Spec §9
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct EmbrefReport {
pub total: u64,
pub resolved: u64,
pub dangling: u64,
pub type_mismatch: u64,
}- Summary
embrefsin aVerifyReport(spec §9 step 10).- Fields
total: u64embrefrecords.resolved: u64Targets that resolve.dangling: u64Targets that do not resolve.type_mismatch: u64Resolvedlocaltargets that are not Compact sections (Compact embedding profile).
- Example
- Example 2: Verify
- Spec
- Spec §9
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct VerifyReport {
pub sha256_ok: bool,
pub header_footer_agree: bool,
pub record_count: RecordCountReport,
pub appendix: AppendixReport,
pub embrefs: EmbrefReport,
}- Summary
The result of
Pack::verify.- Fields
sha256_ok: boolStep 6: the SHA-256 digest matches the footer.header_footer_agree: boolStep 4: the header agrees with the footer (or is a placeholder).record_count: RecordCountReportStep 8.appendix: AppendixReportStep 9.embrefs: EmbrefReportStep 10.
- Example
- Example 2: Verify
- Spec
- Spec §9
pub fn is_ok(&self) -> bool- Summary
Whether every check passed.
- Parameters
- None.
- Returns
bool- Example
- Example 2: Verify
- Spec
- Spec §9
pub fn to_json_value(&self) -> Value- Summary
The report as JSON with snake_case keys.
- Parameters
- None.
- Returns
Value- Example
- Example 2: Verify
- Spec
- Spec §9
pub fn to_json(&self) -> String- Summary
to_json_valueas compact JSON text.- Parameters
- None.
- Returns
String- Example
- Example 2: Verify
- Spec
- Spec §9
© 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.