Skip to main content

weavatrix_semantic/linker/
report.rs

1use super::{CandidateBackend, SemanticLinkReport};
2
3impl CandidateBackend {
4    /// Stable backend identifier stored in reports and edge evidence.
5    #[must_use]
6    pub const fn as_str(self) -> &'static str {
7        match self {
8            Self::Exact => "exact",
9            Self::WeavatrixVector => "weavatrix_search_vector",
10        }
11    }
12
13    /// Whether candidate coverage is exhaustive.
14    #[must_use]
15    pub const fn is_exact(self) -> bool {
16        matches!(self, Self::Exact)
17    }
18}
19
20impl SemanticLinkReport {
21    /// Number of input vectors.
22    #[must_use]
23    pub const fn vector_count(&self) -> usize {
24        self.vector_count
25    }
26
27    /// Shared embedding dimension, or zero for an empty input.
28    #[must_use]
29    pub const fn dimension(&self) -> usize {
30        self.dimension
31    }
32
33    /// Exact eligible-pair cosine comparisons performed by exhaustive linking.
34    #[must_use]
35    pub const fn comparisons(&self) -> u64 {
36        self.comparisons
37    }
38
39    /// Number of distinct unordered endpoint pairs represented by the edges.
40    #[must_use]
41    pub const fn pair_count(&self) -> usize {
42        self.pair_count
43    }
44
45    /// Backend used to generate semantic candidates.
46    #[must_use]
47    pub const fn candidate_backend(&self) -> CandidateBackend {
48        self.candidate_backend
49    }
50
51    /// Stable eligibility policy identifier.
52    #[must_use]
53    pub fn policy_id(&self) -> &str {
54        &self.policy_id
55    }
56
57    /// Number of emitted directed graph edges.
58    #[must_use]
59    pub const fn edge_count(&self) -> usize {
60        self.edges.len()
61    }
62
63    /// Directed semantic graph edges.
64    #[must_use]
65    pub fn edges(&self) -> &[weavatrix_graph::Edge] {
66        &self.edges
67    }
68
69    /// Consumes the report and returns its graph edges.
70    #[must_use]
71    pub fn into_edges(self) -> Vec<weavatrix_graph::Edge> {
72        self.edges
73    }
74}