pub struct Lorebook {
pub config: LorebookConfig,
/* private fields */
}Fields§
§config: LorebookConfigImplementations§
Source§impl Lorebook
impl Lorebook
Sourcepub fn load_from_directory(
path: impl AsRef<Path>,
) -> Result<Self, ContextWeaverError>
pub fn load_from_directory( path: impl AsRef<Path>, ) -> Result<Self, ContextWeaverError>
Load a lorebook from a directory on disk.
Expects lorebook.yaml at the root and .weaver files in an
entries/ subdirectory (or directly in the root).
Sourcepub fn add_entry(&mut self, entry: Entry)
pub fn add_entry(&mut self, entry: Entry)
Add an entry to the lorebook. Replaces any existing entry with the same ID.
Sourcepub fn remove_entry(&mut self, id: &str) -> Option<Entry>
pub fn remove_entry(&mut self, id: &str) -> Option<Entry>
Remove an entry by ID.
Sourcepub fn entries_in_order(&self) -> impl Iterator<Item = &Entry>
pub fn entries_in_order(&self) -> impl Iterator<Item = &Entry>
Iterate all entries in evaluation order (highest priority first).
Sourcepub fn active_entries(&self) -> impl Iterator<Item = &Entry>
pub fn active_entries(&self) -> impl Iterator<Item = &Entry>
Iterate all enabled entries (skips disabled).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Lorebook
impl RefUnwindSafe for Lorebook
impl Send for Lorebook
impl Sync for Lorebook
impl Unpin for Lorebook
impl UnsafeUnpin for Lorebook
impl UnwindSafe for Lorebook
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