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) with b (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: &Pack
  • b: &Pack
Returns
Result<Diff>
Errors

Record kinds when either body cannot be read; appendix kinds when either appendix cannot be opened.

Structs

struct

DiffChange

Spec §8.2
#[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 in a.
  • after: StringThe record line in b.
struct

AppendixDiff

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 in b.
  • removed: Vec<usize>Section indexes only in a.
  • changed: Vec<usize>Section indexes in both whose type or descriptor CRC32C differs.
struct

Diff

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 in b, in sort-key order.
  • removed: Vec<String>Record lines whose key is only in a, 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.

© 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