Skip to main content

Document

Struct Document 

Source
pub struct Document {
    pub schema_version: String,
    pub parser: ParserInfo,
    pub profile: ProfileRef,
    pub source: SourceInfo,
    pub config_sha256: String,
    pub payload_sha256: String,
    pub fingerprint: String,
    pub payload: Payload,
    pub diagnostics: Option<Value>,
}
Expand description

Top-level document artifact (ethos.json).

Fields§

§schema_version: String

Contract schema version.

§parser: ParserInfo

Producing parser.

§profile: ProfileRef

Deterministic profile identity.

§source: SourceInfo

Source identity.

§config_sha256: String

sha256 of c14n(effective-config subset).

§payload_sha256: String

sha256 of c14n(stable payload projection).

§fingerprint: String

Composite document fingerprint (sha256:…).

§payload: Payload

The emitted payload; payload_sha256 binds its stable projection.

§diagnostics: Option<Value>

Runtime-only diagnostics; excluded from canonical equality and all fingerprints. Omitted by default (--diagnostics opts in) so default outputs are byte-identical.

Implementations§

Source§

impl Document

Source

pub fn payload_c14n(&self) -> Result<Vec<u8>, EthosError>

c14n bytes of the emitted payload.

Source

pub fn payload_fingerprint_c14n(&self) -> Result<Vec<u8>, EthosError>

Stable c14n bytes of the payload projection used by fingerprints and G3.

Source

pub fn compute_payload_sha256(&self) -> Result<String, EthosError>

Recompute payload_sha256 from the stable payload projection.

Source

pub fn compute_payload_sha256_for_payload( payload: &Payload, ) -> Result<String, EthosError>

Compute payload_sha256 for an assembled payload before the envelope exists.

Source

pub fn payload_fingerprint_value(&self) -> Result<Value, EthosError>

Build the stable payload projection used by payload_sha256.

Source

pub fn compute_raw_payload_sha256(&self) -> Result<String, EthosError>

Recompute the raw payload hash for diagnostics only.

Source

pub fn compute_fingerprint(&self) -> Result<String, EthosError>

Recompute the composite fingerprint from embedded envelope fields.

Source

pub fn verify_integrity(&self) -> Result<(), EthosError>

Verify internal hash consistency (used by ethos fingerprint): embedded payload_sha256 and fingerprint match recomputation.

Trait Implementations§

Source§

impl Clone for Document

Source§

fn clone(&self) -> Document

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Document

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Document

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl GroundingSource for Document

Ethos output is itself just another grounding source (PRD §1.5): the verify layer sees Ethos through the same trait as any foreign parser.

Source§

fn parser(&self) -> ParserIdentity

Identity of the producing parser (+ adapter when foreign).
Source§

fn capabilities(&self) -> Capabilities

Capability declaration; drives explicit verification downgrades.
Source§

fn fingerprint(&self) -> Option<String>

Document fingerprint when the source declares one (sha256:… for Ethos).
Source§

fn pages(&self) -> Vec<PageGeometry>

Page geometry, ascending page index.
Source§

fn elements(&self) -> Vec<GroundingElement>

Elements in the source’s canonical order.
Source§

fn element_by_id(&self, id: &str) -> Option<GroundingElement>

Element lookup by id. Default: linear scan over Self::elements. Read more
Source§

fn spans(&self) -> Vec<GroundingSpan>

Spans, when capability spans is true. Default: none.
Source§

fn tables(&self) -> Vec<GroundingTable>

Tables, when the source models them. Default: none (verification of table_cell claims downgrades accordingly).
Source§

fn crop_ref(&self, _page: &str, _bbox: [i64; 4]) -> Option<String>

Stable crop reference for an evidence region, when crop_support is true. The verify layer treats this as an opaque audit pointer; sources own how the referenced crop artifact is generated and stored.
Source§

impl PartialEq for Document

Source§

fn eq(&self, other: &Document) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Document

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Document

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.