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§
Sourcefn bind(&self, name: &str, value: &str) -> Result<Self, TypeError>where
Self: Sized,
fn bind(&self, name: &str, value: &str) -> Result<Self, TypeError>where
Self: Sized,
Bind a variable in the message content, returning a new instance
Sourcefn bind_mut(&mut self, name: &str, value: &str) -> Result<(), TypeError>
fn bind_mut(&mut self, name: &str, value: &str) -> Result<(), TypeError>
Bind a variable in-place
Sourcefn extract_variables(&self) -> Vec<String>
fn extract_variables(&self) -> Vec<String>
Extract variables from the message content
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>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".