1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! # `pcf` — Partitioned Container Format reference implementation
//!
//! This crate is the reference reader/writer for **PCF v1.0**, a
//! language-agnostic binary container that stores multiple independent regions
//! of bytes ("partitions") in a single file. It mirrors the written
//! specification field-for-field and favours auditability over performance.
//!
//! ## Layout at a glance
//!
//! ```text
//! [ 20-byte header ] [ table block(s) ] [ partition data regions ]
//! ```
//!
//! * **Header** (20 B): magic, major/minor version, offset of the first table
//! block.
//! * **Table block** (74 B header + N x 141 B entries): a linked chain; each
//! block is self-verified by its own hash.
//! * **Entry** (141 B): type, 16-byte UID, 32-byte label, start offset, max
//! length, used bytes, and a 64-byte data hash with an algorithm id.
//!
//! All integers are little-endian. Free space is derived as
//! `max_length - used_bytes`.
//!
//! ## Example
//!
//! ```
//! use std::io::Cursor;
//! use pcf::{Container, HashAlgo};
//!
//! let mut c = Container::create(Cursor::new(Vec::new())).unwrap();
//! let uid = [1u8; 16];
//! c.add_partition(0x10, uid, "notes", b"hello world", 64, HashAlgo::Sha256)
//! .unwrap();
//!
//! c.verify().unwrap();
//! let entries = c.entries().unwrap();
//! assert_eq!(entries.len(), 1);
//! assert_eq!(c.read_partition_data(&entries[0]).unwrap(), b"hello world");
//! ```
pub use *;
pub use ;
pub use ;
pub use ;
pub use HashAlgo;
pub use FileHeader;
pub use ;