ns-keyed-archive

Crates.ions-keyed-archive
lib.rsns-keyed-archive
version0.1.3
created_at2025-03-10 02:52:19.814089+00
updated_at2025-03-15 04:58:04.500179+00
descriptionA library to encode/decode NSKeyedArchive binary plists
homepage
repositoryhttps://github.com/jkcoxson/ns_keyed_archive
max_upload_size
id1586090
size24,621
Jackson Coxson (jkcoxson)

documentation

README

ns_keyed_archive

A library to encode/decode NSKeyedArchive-formatted binary plists Based off the work from NSKeyedArchiver Converter

Usage

Add this library and plist to your Cargo.toml

[dependencies]
plist = "1.7"
ns_keyed_archive = "*"
use plist;

// Create a new plist and insert values
let mut d = plist::Dictionary::new();
let a = plist::Value::Array(vec!["a".into(), 1.into()]);
d.insert("reeeeee".to_string(), a);
d.insert("asdf".into(), "qwer".into());

let mut d_d = plist::Dictionary::new();
d_d.insert("fortnite".into(), plist::Value::Boolean(false));
d.insert("good games".into(), d_d.into());

// Encode the binary in an archived binary plist
let b = encode::encode_to_bytes(d.clone().into()).unwrap();

// Decode it again
let d1 = decode::from_bytes(&b).unwrap();
assert_eq!(plist::Value::Dictionary(d), d1);

// Another example
let s = plist::Value::String("asdf".into());
let b = encode::encode_to_bytes(s.clone()).unwrap();
let s1 = decode::from_bytes(&b).unwrap();
assert_eq!(s, s1);
Commit count: 9

cargo fmt