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

Reader-Core: steps 1–8

  1. SizeRaised as an error
  2. HeaderRaised as an error
  3. FooterRaised as an error
  4. Header against footerReported in header_footer_agree
  5. LayoutRaised as an error
  6. DigestReported in sha256_ok
  7. BodyRaised as an error
  8. CountReported in record_count

Reader-Appendix: steps 9–10

  1. Appendixonly with an appendixReported in appendix; raised when the appendix cannot be opened
  2. BindingsReported in embrefs
The ten steps of spec §9, in order. 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.
Table 1. Verify steps (10 rows)
StepNameResult
1SizeRaised as an error
2HeaderRaised as an error
3FooterRaised as an error
4Header against footerReported in header_footer_agree
5LayoutRaised as an error
6DigestReported in sha256_ok
7BodyRaised as an error
8CountReported in record_count
9AppendixReported in appendix; raised when the appendix cannot be opened
10BindingsReported in embrefs

Methods on Pack

method

Pack::verify

Spec §9
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.

method

Pack::bind_embrefs

Spec §5.4
pub fn bind_embrefs(&self, profile: BindProfile) -> Result<Vec<BoundEmbedding>>
Summary

Bind every embref target under profile (spec §9 step 10).

Returns one BoundEmbedding per embref record, in record order.

Parameters
  • profile: BindProfile
Returns
Result<Vec<BoundEmbedding>>
Errors

dangling_embref for the first target that does not resolve (including any local target in a pack with no appendix); section_type_mismatch for the first resolved target that is not a Compact section; unsupported for an ext target, whose bytes live in another file; appendix kinds from opening the appendix or reading a section.

Structs

struct

RecordCountReport

Spec §9
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct RecordCountReport {
    pub declared: u64,
    pub actual: u64,
}
Summary

record_count in a VerifyReport.

Fields
  • declared: u64The footer's record_count.
  • actual: u64Record lines actually present.
struct

SectionCrcReport

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.
struct

AppendixReport

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

appendix in a VerifyReport.

Fields
  • present: boolWhether the pack has an appendix.
  • file_checksum_ok: boolWhether the footer's csdt_file_checksum equals the container's file_checksum (with no appendix: whether the footer copy is 0).
  • sections: Vec<SectionCrcReport>Per-section CRC results.
struct

EmbrefReport

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

embrefs in a VerifyReport (spec §9 step 10).

Fields
  • total: u64embref records.
  • resolved: u64Targets that resolve.
  • dangling: u64Targets that do not resolve.
  • type_mismatch: u64Resolved local targets that are not Compact sections (Compact embedding profile).
struct

VerifyReport

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.

© 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.

Sections