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>;

    // Provided methods
    fn extract_media_variables(&self) -> Vec<String> { ... }
    fn split_media_placeholders(&mut self) -> Result<(), TypeError> { ... }
    fn bind_media_mut(
        &mut self,
        _token: &str,
        _media: &MediaRef,
        _provider: &Provider,
    ) -> Result<bool, 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>

Provided Methods§

Source

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

Source

fn split_media_placeholders(&mut self) -> Result<(), TypeError>

Source

fn bind_media_mut( &mut self, _token: &str, _media: &MediaRef, _provider: &Provider, ) -> Result<bool, TypeError>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§