pub struct KnowledgeSnapshot {
pub project_root: String,
pub project_hash: String,
pub facts: Vec<KnowledgeFact>,
pub patterns: Vec<ProjectPattern>,
pub insights: Vec<ConsolidatedInsight>,
pub relations: Vec<KnowledgeEdge>,
}Expand description
A consistent read of a project’s knowledge (facts + patterns + insights) and its relation graph, taken at one point in time. The single source of truth for outbound renderings (ctxpkg, OKF).
Fields§
§project_root: String§project_hash: String§facts: Vec<KnowledgeFact>All facts, including superseded ones (ctxpkg keeps the history).
patterns: Vec<ProjectPattern>§insights: Vec<ConsolidatedInsight>Consolidated insights (the project’s history).
relations: Vec<KnowledgeEdge>Typed relations between facts (relations.json).
Implementations§
Source§impl KnowledgeSnapshot
impl KnowledgeSnapshot
Sourcepub fn collect(project_root: &str) -> Self
pub fn collect(project_root: &str) -> Self
Loads a project’s knowledge and relation graph from disk into one
snapshot. Missing stores yield empty collections rather than an error, so
callers can treat “no knowledge yet” via KnowledgeSnapshot::is_empty.
Sourcepub fn from_project(
knowledge: &ProjectKnowledge,
relations: Vec<KnowledgeEdge>,
) -> Self
pub fn from_project( knowledge: &ProjectKnowledge, relations: Vec<KnowledgeEdge>, ) -> Self
Builds a snapshot from an already-loaded ProjectKnowledge plus its
relation edges. Keeps the collection logic in one place for callers that
already hold the knowledge (e.g. inside a lock).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when there is nothing worth exporting (no facts, patterns, or insights). Relations alone never make a bundle — they are edges between facts that, without endpoints, carry no standalone meaning.
Sourcepub fn current_facts(&self) -> Vec<&KnowledgeFact>
pub fn current_facts(&self) -> Vec<&KnowledgeFact>
The current (non-superseded, temporally valid) facts — the human-facing
view portable exports render. Superseded history stays in Self::facts
for ctxpkg fidelity but would only confuse a hand-edited OKF bundle.
Trait Implementations§
Source§impl Clone for KnowledgeSnapshot
impl Clone for KnowledgeSnapshot
Source§fn clone(&self) -> KnowledgeSnapshot
fn clone(&self) -> KnowledgeSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for KnowledgeSnapshot
impl RefUnwindSafe for KnowledgeSnapshot
impl Send for KnowledgeSnapshot
impl Sync for KnowledgeSnapshot
impl Unpin for KnowledgeSnapshot
impl UnsafeUnpin for KnowledgeSnapshot
impl UnwindSafe for KnowledgeSnapshot
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more