#[non_exhaustive]pub enum FrameKind {
Snippet,
Symbol,
Fact,
Doc,
Memory,
Episode,
Graph,
Unknown(String),
}Expand description
What kind of thing a frame represents (SPEC.md §6).
§Why this is not a closed enum
The protocol guarantees no flag day inside a major family: a contextgraph/1.0
host and a contextgraph/1.1 host interoperate, and minor versions may add
vocabulary. A closed enum contradicts that guarantee twice over. A frame
carrying a kind introduced in 1.1 would fail to deserialize on a 1.0
host — not degrade, fail — and every exhaustive match in downstream Rust
would break the day a variant was added.
So FrameKind follows the same shape as EgressScope:
a closed base vocabulary of seven kinds, plus an
Unknown variant that preserves the original string.
A host that does not recognize a kind can still parse the frame, route it,
budget it, cite it, and re-serialize it byte-identically.
That last property is why Unknown carries a String rather than being a
bare unit variant with #[serde(other)]. #[serde(other)] collapses every
unrecognized value into one variant and discards the original, so a host
relaying a frame it did not fully understand would silently rewrite
"kind": "trajectory" to something else on the way out. A forward-compat
mechanism that corrupts data in a relay is worse than the failure it
replaces.
§#[non_exhaustive]
The attribute forces downstream match expressions to carry a wildcard arm,
which makes every future kind addition a non-breaking change for every
consumer. It is a one-time cost paid now so the version promise holds
forever after.
§Not Copy
Preserving an unknown kind’s string means the type owns an allocation, so it
cannot be Copy. Forward compatibility is a protocol guarantee; Copy was
an ergonomic convenience. When the two conflict the guarantee wins.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Snippet
Symbol
Fact
Doc
Memory
Episode
Graph
Unknown(String)
A kind this revision does not define — most likely one introduced by a later minor version of the same major family. The original wire string is retained verbatim so the frame round-trips unchanged.
A host MUST NOT reject a frame for carrying an unknown kind. It may decline to specialize its handling — that is a rendering decision, not a validity one.
Implementations§
Source§impl FrameKind
impl FrameKind
Sourcepub const KNOWN: &'static [&'static str]
pub const KNOWN: &'static [&'static str]
Every kind this revision names — a registry, not a restriction.