pub trait PromptSource {
// Required method
fn read(&self, path: &Path) -> Result<String, PromptError>;
}Expand description
Somewhere prompt files can be read from.
The indirection exists so prompt composition can be tested without touching a filesystem, and so the Tower can later serve prompts from somewhere other than a directory.
Required Methods§
Sourcefn read(&self, path: &Path) -> Result<String, PromptError>
fn read(&self, path: &Path) -> Result<String, PromptError>
Reads the prompt file at path, which is always relative to the source’s root.
§Errors
Returns PromptError::Missing when there is no such file, or PromptError::Unreadable
when it exists but cannot be read.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".