Skip to main content

SkillProvider

Trait SkillProvider 

Source
pub trait SkillProvider: Send + Sync {
    // Required methods
    fn list<'a>(
        &'a self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SkillInfo>, SkillError>> + Send + 'a>>;
    fn load<'a>(
        &'a self,
        name: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Skill, SkillError>> + Send + 'a>>;
    fn read_file<'a>(
        &'a self,
        name: &'a str,
        path: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<String, SkillError>> + Send + 'a>>;
}
Expand description

The harness side of submilli:skills.

Required Methods§

Source

fn list<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<Vec<SkillInfo>, SkillError>> + Send + 'a>>

Every skill the harness offers, each under a name Self::load accepts. The engine removes the ones the policy denies to the caller, and any whose name it would refuse, before the program sees the list.

Source

fn load<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Skill, SkillError>> + Send + 'a>>

The skill named name, whose returned name must be exactly name.

name comes from the program and the policy decided on it as written, so match it byte for byte: no case folding, Unicode normalization or path canonicalization, or a policy that denies secrets would let Secrets through. The engine passes only one segment of at most 4096 bytes that is not empty, . or .. and has no /, \ or NUL; it may contain :, so never use it as a path.

Source

fn read_file<'a>( &'a self, name: &'a str, path: &'a str, ) -> Pin<Box<dyn Future<Output = Result<String, SkillError>> + Send + 'a>>

The text of the file at path inside skill name. name is checked and must be matched as for Self::load. path is relative, uses / separators, has no empty, . or .. segment and no \, : or NUL, and is at most 4096 bytes. The engine does not decode it: a provider that percent-decodes must check the decoded path again.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§