pub struct Fact {
pub key: ContextKey,
pub id: String,
pub content: String,
}Expand description
A typed assertion added to context.
Facts are immutable once created. They carry provenance for auditability.
Fields§
§key: ContextKeyThe category this fact belongs to.
id: StringUnique identifier within the context.
content: StringThe fact’s content (simplified for MVP).
Implementations§
Source§impl Fact
impl Fact
Sourcepub fn new(
key: ContextKey,
id: impl Into<String>,
content: impl Into<String>,
) -> Self
pub fn new( key: ContextKey, id: impl Into<String>, content: impl Into<String>, ) -> Self
Creates a new fact.
§Example
use converge_core::{Fact, ContextKey};
let fact = Fact::new(ContextKey::Seeds, "seed-1", "initial value");
assert_eq!(fact.key, ContextKey::Seeds);
assert_eq!(fact.id, "seed-1");Trait Implementations§
Source§impl<'de> Deserialize<'de> for Fact
impl<'de> Deserialize<'de> for Fact
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 TryFrom<ProposedFact> for Fact
impl TryFrom<ProposedFact> for Fact
Source§fn try_from(proposed: ProposedFact) -> Result<Self, Self::Error>
fn try_from(proposed: ProposedFact) -> Result<Self, Self::Error>
Converts a ProposedFact to a Fact after validation.
This is the ONLY way to promote a proposal to a fact. In production, this would include schema validation, constraint checks, and governance rules.
Source§type Error = ValidationError
type Error = ValidationError
The type returned in the event of a conversion error.
impl Eq for Fact
impl StructuralPartialEq for Fact
Auto Trait Implementations§
impl Freeze for Fact
impl RefUnwindSafe for Fact
impl Send for Fact
impl Sync for Fact
impl Unpin for Fact
impl UnwindSafe for Fact
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
Mutably borrows from an owned value. Read more