Skip to main content

PromptMessageExt

Trait PromptMessageExt 

Source
pub trait PromptMessageExt:
    Send
    + Sync
    + Clone
    + Serialize
    + for<'de> Deserialize<'de>
    + PartialEq {
    // Required methods
    fn bind(&self, name: &str, value: &str) -> Result<Self, TypeError>
       where Self: Sized;
    fn bind_mut(&mut self, name: &str, value: &str) -> Result<(), TypeError>;
    fn extract_variables(&self) -> Vec<String>;
    fn from_text(content: String, role: &str) -> Result<Self, TypeError>;
}
Expand description

Core trait that all message types must implement

Required Methods§

Source

fn bind(&self, name: &str, value: &str) -> Result<Self, TypeError>
where Self: Sized,

Bind a variable in the message content, returning a new instance

Source

fn bind_mut(&mut self, name: &str, value: &str) -> Result<(), TypeError>

Bind a variable in-place

Source

fn extract_variables(&self) -> Vec<String>

Extract variables from the message content

Source

fn from_text(content: String, role: &str) -> Result<Self, TypeError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§