pub struct KnowledgeShelf { /* private fields */ }Expand description
Local knowledge shelf store.
Implementations§
Source§impl KnowledgeShelf
impl KnowledgeShelf
Sourcepub fn upsert(&mut self, record: ShelfRecord)
pub fn upsert(&mut self, record: ShelfRecord)
Inserts or replaces a shelf record.
Sourcepub fn get(&self, id: &str) -> Option<&ShelfRecord>
pub fn get(&self, id: &str) -> Option<&ShelfRecord>
Returns a shelf record.
Sourcepub fn get_mut(&mut self, id: &str) -> Option<&mut ShelfRecord>
pub fn get_mut(&mut self, id: &str) -> Option<&mut ShelfRecord>
Returns a mutable shelf record.
Sourcepub fn iter(&self) -> impl Iterator<Item = &ShelfRecord>
pub fn iter(&self) -> impl Iterator<Item = &ShelfRecord>
Iterates records in deterministic id order.
Sourcepub fn search<F>(&self, query: &str, markdown_for: F) -> Vec<ShelfSearchResult>
pub fn search<F>(&self, query: &str, markdown_for: F) -> Vec<ShelfSearchResult>
Searches shelf metadata and caller-provided Markdown exports.
The markdown_for callback lets hosts load exported Markdown from local
storage without making index-core perform filesystem IO.
Sourcepub fn save_to_path(&self, path: impl AsRef<Path>) -> Result<(), ShelfError>
pub fn save_to_path(&self, path: impl AsRef<Path>) -> Result<(), ShelfError>
Saves the shelf to disk.
Sourcepub fn load_from_path(path: impl AsRef<Path>) -> Result<Self, ShelfError>
pub fn load_from_path(path: impl AsRef<Path>) -> Result<Self, ShelfError>
Loads a shelf from disk. Missing shelves are treated as empty shelves.
Trait Implementations§
Source§impl Clone for KnowledgeShelf
impl Clone for KnowledgeShelf
Source§fn clone(&self) -> KnowledgeShelf
fn clone(&self) -> KnowledgeShelf
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 KnowledgeShelf
impl Debug for KnowledgeShelf
Source§impl Default for KnowledgeShelf
impl Default for KnowledgeShelf
Source§fn default() -> KnowledgeShelf
fn default() -> KnowledgeShelf
Returns the “default value” for a type. Read more
Source§impl PartialEq for KnowledgeShelf
impl PartialEq for KnowledgeShelf
Source§fn eq(&self, other: &KnowledgeShelf) -> bool
fn eq(&self, other: &KnowledgeShelf) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for KnowledgeShelf
impl StructuralPartialEq for KnowledgeShelf
Auto Trait Implementations§
impl Freeze for KnowledgeShelf
impl RefUnwindSafe for KnowledgeShelf
impl Send for KnowledgeShelf
impl Sync for KnowledgeShelf
impl Unpin for KnowledgeShelf
impl UnsafeUnpin for KnowledgeShelf
impl UnwindSafe for KnowledgeShelf
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