doldskrift 0.5.0

Machine-native typography, encoding, and agent communication (DOLDSKRIFT/1)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Canonical form helpers for deterministic encoding.

use crate::semantic::{encode_value, Value};
use crate::Result;

/// Canonical encode a semantic value to bytes.
pub fn canonical_bytes(value: &Value) -> Result<Vec<u8>> {
    encode_value(value, true)
}

/// Compare two byte slices for canonical equality.
pub fn bytes_equal(a: &[u8], b: &[u8]) -> bool {
    a == b
}