Cotton code
33 lines · 1.0 KB · RustRaw
//! The three content fingerprints — the ids that make a re-import a no-op.//!//! All three answer the same rule: identity is CONTENT, never a person. A//! sender's number, a recipient's address, a payee — none of them is in any//! material, so naming someone later changes nothing about what a re-import//! skips. The material is where drift happens, so each has vector tests taken//! from the TypeScript's own suite (spec R7).use std::fmt;/// A fingerprint's material that cannot be read: a `TypeError`-shaped/// refusal (the store turns it into its own `StoreError::Encode`).#[derive(Debug, Clone, PartialEq, Eq)]pub struct EncodeError(pub String);impl fmt::Display for EncodeError {    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {        f.write_str(&self.0)    }}impl std::error::Error for EncodeError {}/// A fingerprint, or why its material cannot be read.pub type Result<T> = std::result::Result<T, EncodeError>;pub mod email;pub mod message;pub mod statement;#[cfg(test)]#[path = "fingerprint_tests.rs"]mod tests;