pub struct Catalogue {
pub prefix: String,
pub errors: BTreeMap<String, String>,
/* private fields */
}Expand description
The catalogue + body cache.
Fields§
§prefix: String§errors: BTreeMap<String, String>Discovery errors per server (surfaced in status, never fatal).
Implementations§
Source§impl Catalogue
impl Catalogue
pub fn new(prefix: &str, max_bytes: usize) -> Catalogue
Sourcepub fn discover(
&mut self,
server: &dyn SkillServer,
mode: Discover,
filter: Option<&str>,
) -> Vec<String>
pub fn discover( &mut self, server: &dyn SkillServer, mode: Discover, filter: Option<&str>, ) -> Vec<String>
(Re)discover the skills of one server. Later sources do not override an existing name (first source wins; a collision is logged by the caller). Returns the names discovered on this server.
Sourcepub fn forget_server(&mut self, server: &str)
pub fn forget_server(&mut self, server: &str)
Forget every skill of server (before a re-discovery).
pub fn get(&self, name: &str) -> Option<&SkillMeta>
pub fn names(&self) -> Vec<String>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn list_value(&self) -> Value
pub fn list_value(&self) -> Value
skills.list output.
Sourcepub fn render_catalogue(&self) -> Option<String>
pub fn render_catalogue(&self) -> Option<String>
The catalogue block for a prompt (names + descriptions), or None
when empty.
Sourcepub fn load(
&mut self,
name: &str,
arguments: Option<Value>,
servers: &dyn Fn(&str) -> Option<Arc<dyn SkillServer>>,
) -> Result<SkillBody, String>
pub fn load( &mut self, name: &str, arguments: Option<Value>, servers: &dyn Fn(&str) -> Option<Arc<dyn SkillServer>>, ) -> Result<SkillBody, String>
Fetch (or serve from cache) a skill body. servers resolves the source
server by name.
Sourcepub fn evict_except(&mut self, keep: &[String])
pub fn evict_except(&mut self, keep: &[String])
Drop cached bodies whose hash is not in keep.
Sourcepub fn references(&self, text: &str) -> Vec<String>
pub fn references(&self, text: &str) -> Vec<String>
The @skill:<name> references in a text (deduplicated, in order).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Catalogue
impl RefUnwindSafe for Catalogue
impl Send for Catalogue
impl Sync for Catalogue
impl Unpin for Catalogue
impl UnsafeUnpin for Catalogue
impl UnwindSafe for Catalogue
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