#[non_exhaustive]pub enum KgMiss {
SubjectNotFound,
GraphEmpty,
}Expand description
Which of the two distinct “no triples came back” outcomes a kg_query hit.
Why (#4775): both outcomes returned the same “Knowledge graph is empty”
hint, and for the common case — a graph with facts, queried for a subject
it does not hold — that hint states something the handler can prove false.
A caller that believes it wastes a kg_bootstrap on an already-seeded
graph instead of listing the subjects that are there.
What: the discriminator behind kg_query’s graph_state response field.
Self::classify decides which one applies; Self::wire_value and
Self::hint are the two strings that reach the caller. Marked
#[non_exhaustive] so a future third outcome is not a breaking change.
Test: kg_miss_classify_distinguishes_empty_graph_from_missing_subject.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
SubjectNotFound
The graph holds active triples, just none for the queried subject.
GraphEmpty
The graph holds no active triples at all.
Implementations§
Source§impl KgMiss
impl KgMiss
Sourcepub fn classify(
subject_triples: usize,
total_active_triples: usize,
) -> Option<Self>
pub fn classify( subject_triples: usize, total_active_triples: usize, ) -> Option<Self>
Classify a kg_query result; None means the subject matched.
Why (#4775): emptiness is a whole-graph property, so it cannot be read
off the per-subject result alone — that conflation is the defect. Both
counts are required, and taking them as parameters keeps the decision
pure and directly testable without a live palace.
What: None when subject_triples > 0. Otherwise GraphEmpty iff the
whole graph reports zero active triples, else SubjectNotFound.
Test: kg_miss_classify_distinguishes_empty_graph_from_missing_subject.
Sourcepub fn wire_value(self) -> &'static str
pub fn wire_value(self) -> &'static str
The string emitted as kg_query’s graph_state field.
Trait Implementations§
impl Copy for KgMiss
impl Eq for KgMiss
impl StructuralPartialEq for KgMiss
Auto Trait Implementations§
impl Freeze for KgMiss
impl RefUnwindSafe for KgMiss
impl Send for KgMiss
impl Sync for KgMiss
impl Unpin for KgMiss
impl UnsafeUnpin for KgMiss
impl UnwindSafe for KgMiss
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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