Diff
- file format 6
- Rust SDK 1.0 preview
Comparing two opened packs, before and after. Records are matched by dedup key and compared in identity form.
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.
Functions
pub fn diff(a: &Pack, b: &Pack) -> Result<Diff>- Summary
Compare
a(before) withb(after), spec §8.2.Records are matched by dedup key and compared by identity form, so a difference only in member order, whitespace or number spelling is not reported. Appendix sections are matched by index and compared by section type and descriptor CRC32C.
- Parameters
a: &Packb: &Pack
- Returns
Result<Diff>- Errors
Record kinds when either body cannot be read; appendix kinds when either appendix cannot be opened.
- Example
- Example 6: Diff
- Spec
- Spec §8.2
Structs
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DiffChange {
pub key: (String, String),
pub before: String,
pub after: String,
}- Summary
One record present on both sides with different identity forms.
- Fields
key: (String, String)The dedup key(kind, primary id).before: StringThe record line ina.after: StringThe record line inb.
- Example
- Example 6: Diff
- Spec
- Spec §8.2
#[non_exhaustive]
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct AppendixDiff {
pub added: Vec<usize>,
pub removed: Vec<usize>,
pub changed: Vec<usize>,
}- Summary
Appendix sections that differ, by section index.
- Fields
added: Vec<usize>Section indexes only inb.removed: Vec<usize>Section indexes only ina.changed: Vec<usize>Section indexes in both whose type or descriptor CRC32C differs.
- Example
- Example 6: Diff
- Spec
- Spec §8.2
#[non_exhaustive]
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Diff {
pub added: Vec<String>,
pub removed: Vec<String>,
pub changed: Vec<DiffChange>,
pub duplicate_keys: Vec<(String, String)>,
pub appendix: AppendixDiff,
}- Summary
The difference between two packs.
- Fields
added: Vec<String>Record lines whose key is only inb, in sort-key order.removed: Vec<String>Record lines whose key is only ina, in sort-key order.changed: Vec<DiffChange>Records in both with different identity forms, in sort-key order.duplicate_keys: Vec<(String, String)>Keys that occur more than once on either side, in sort-key order. They are listed here and compared nowhere else.appendix: AppendixDiffAppendix section differences.
- Example
- Example 6: Diff
- Spec
- Spec §8.2
pub fn is_empty(&self) -> bool- Summary
Whether the two packs are the same in every compared respect.
- Parameters
- None.
- Returns
bool- Example
- Example 6: Diff
- Spec
- Spec §8.2
pub fn to_json_value(&self) -> Value- Parameters
- None.
- Returns
Value- Example
- Example 6: Diff
- Spec
- Spec §8.2
pub fn to_json(&self) -> String- Summary
to_json_valueas compact JSON text.- Parameters
- None.
- Returns
String- Example
- Example 6: Diff
- Spec
- Spec §8.2
© 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.