Skip to main content

Claim

Struct Claim 

Source
pub struct Claim { /* private fields */ }
Expand description

A committed claim — write-once and immutable after it is appended to the store.

All fields are set at injection time via Claim::new; no field may be mutated after commit. Fields are private to enforce the write-once invariant at compile time: non-destruction (all writes are INSERT-only) and provenance immutability are both upheld by the absence of setters.

Implementations§

Source§

impl Claim

Source

pub fn new( claim_ref: ClaimRef, agent_id: AgentId, fact: Fact, cardinality: Cardinality, provenance: ProvenanceLabel, external_anchor: ExternalAnchor, transaction_time: TransactionTime, valid_time: ValidTime, confidence: Confidence, criticality: Criticality, derived_from: Vec<ClaimRef>, metadata: Option<Value>, snapshot_schema_version: Option<u32>, ) -> Self

Construct a fully-formed, frozen Claim. The only constructor.

Source

pub fn claim_ref(&self) -> &ClaimRef

Return the stable claim reference (UUID).

Source

pub fn agent_id(&self) -> &AgentId

Return the agent that owns this claim.

Source

pub fn fact(&self) -> &Fact

Return the (subject, predicate, value) triple.

Source

pub fn cardinality(&self) -> &Cardinality

Return the caller-supplied cardinality hint.

Source

pub fn provenance(&self) -> &ProvenanceLabel

Return the provenance label.

Source

pub fn external_anchor(&self) -> &ExternalAnchor

Return the external anchor (source document, URL, etc.).

Source

pub fn transaction_time(&self) -> &TransactionTime

Return the transaction time (when the claim was written to the store).

Source

pub fn valid_time(&self) -> &ValidTime

Return the valid-time window (when the claim holds in the world).

Source

pub fn confidence(&self) -> &Confidence

Return the dual confidence scores.

Source

pub fn criticality(&self) -> &Criticality

Return the criticality class.

Source

pub fn derived_from(&self) -> &[ClaimRef]

Return the list of upstream claims this claim was derived from.

Source

pub fn metadata(&self) -> Option<&Value>

Return the optional caller-supplied metadata blob.

Source

pub fn snapshot_schema_version(&self) -> Option<u32>

Return the optional snapshot schema version for migration support.

Trait Implementations§

Source§

impl Clone for Claim

Source§

fn clone(&self) -> Claim

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 Claim

Source§

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

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

impl<'de> Deserialize<'de> for Claim

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 Serialize for Claim

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

Auto Trait Implementations§

§

impl Freeze for Claim

§

impl RefUnwindSafe for Claim

§

impl Send for Claim

§

impl Sync for Claim

§

impl Unpin for Claim

§

impl UnsafeUnpin for Claim

§

impl UnwindSafe for Claim

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> 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.