pub struct KnowledgeBase { /* private fields */ }Expand description
In-memory collection of knowledge base entries.
Implementations§
Source§impl KnowledgeBase
impl KnowledgeBase
Sourcepub fn embedded() -> &'static KnowledgeBase
pub fn embedded() -> &'static KnowledgeBase
Return the embedded, compile-time knowledge base.
Entries are included via include_str! and parsed on first access.
To add a new entry, add the file to data/knowledge-base/examples/
and add an include_str! line to EMBEDDED_ENTRIES_JSON above.
Sourcepub fn from_entries(entries: Vec<KnowledgeEntry>) -> Self
pub fn from_entries(entries: Vec<KnowledgeEntry>) -> Self
Construct from an in-memory list (for tests).
pub fn all(&self) -> &[KnowledgeEntry]
pub fn by_id(&self, id: &str) -> Option<&KnowledgeEntry>
pub fn by_category(&self, category: &str) -> Vec<&KnowledgeEntry>
Sourcepub fn require(&self, id: &str) -> Result<&KnowledgeEntry>
pub fn require(&self, id: &str) -> Result<&KnowledgeEntry>
Get-or-error variant useful in MCP tool handlers.
pub fn suggest(&self, query: &str, limit: usize) -> Vec<SuggestResult>
Trait Implementations§
Source§impl Clone for KnowledgeBase
impl Clone for KnowledgeBase
Source§fn clone(&self) -> KnowledgeBase
fn clone(&self) -> KnowledgeBase
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KnowledgeBase
impl Debug for KnowledgeBase
Source§impl Default for KnowledgeBase
impl Default for KnowledgeBase
Source§fn default() -> KnowledgeBase
fn default() -> KnowledgeBase
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for KnowledgeBase
impl RefUnwindSafe for KnowledgeBase
impl Send for KnowledgeBase
impl Sync for KnowledgeBase
impl Unpin for KnowledgeBase
impl UnsafeUnpin for KnowledgeBase
impl UnwindSafe for KnowledgeBase
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