pub struct ContextFact { /* private fields */ }Expand description
Read-only projection of a validated assertion in the context.
This type is not promotion authority. It is the value suggestors and
pack authors can read from context after the engine has promoted a
proposal. Constructing one locally does not admit it into Converge; there is
no public API that accepts a ContextFact as promoted truth.
Implementations§
Source§impl ContextFact
impl ContextFact
Sourcepub fn new_projection(
key: ContextKey,
id: impl Into<FactId>,
content: impl Into<String>,
promotion_record: FactPromotionRecord,
created_at: impl Into<Timestamp>,
) -> ContextFact
pub fn new_projection( key: ContextKey, id: impl Into<FactId>, content: impl Into<String>, promotion_record: FactPromotionRecord, created_at: impl Into<Timestamp>, ) -> ContextFact
Creates a read-only context projection.
This constructor does not promote anything and is intentionally named as
a projection constructor. The engine is still the only component that can
add context facts to a live ContextState.
Sourcepub fn key(&self) -> ContextKey
pub fn key(&self) -> ContextKey
Returns the context key this fact belongs to.
Sourcepub fn promotion_record(&self) -> &FactPromotionRecord
pub fn promotion_record(&self) -> &FactPromotionRecord
Returns the immutable promotion record for this fact.
Sourcepub fn created_at(&self) -> &Timestamp
pub fn created_at(&self) -> &Timestamp
Returns the fact creation timestamp.
Sourcepub fn is_replay_eligible(&self) -> bool
pub fn is_replay_eligible(&self) -> bool
Returns whether the fact is replay-eligible.
Sourcepub fn parse_json_content<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
pub fn parse_json_content<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
Parse the fact’s content as JSON into a typed value.
This helper is deliberately named for JSON and preserves parse errors.
Callers that use another representation should parse content with
that representation’s decoder.
Trait Implementations§
Source§impl Clone for ContextFact
impl Clone for ContextFact
Source§fn clone(&self) -> ContextFact
fn clone(&self) -> ContextFact
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContextFact
impl Debug for ContextFact
Source§impl<'de> Deserialize<'de> for ContextFact
impl<'de> Deserialize<'de> for ContextFact
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContextFact, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContextFact, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ContextFact
impl PartialEq for ContextFact
Source§fn eq(&self, other: &ContextFact) -> bool
fn eq(&self, other: &ContextFact) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ContextFact
impl Serialize for ContextFact
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for ContextFact
impl StructuralPartialEq for ContextFact
Auto Trait Implementations§
impl Freeze for ContextFact
impl RefUnwindSafe for ContextFact
impl Send for ContextFact
impl Sync for ContextFact
impl Unpin for ContextFact
impl UnsafeUnpin for ContextFact
impl UnwindSafe for ContextFact
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.