pub trait ConversationProjector {
type Output;
// Required method
fn project(&self, view: &ConversationView) -> Result<Self::Output>;
}Expand description
Convert a ConversationView into an output type.
Implement this trait to serialize, render, or transform a conversation
into any target representation (e.g. Toolpath Path, Markdown, JSON-LD).
§Example
use toolpath_convo::{ConversationView, ConversationProjector, Result};
struct TurnCounter;
impl ConversationProjector for TurnCounter {
type Output = usize;
fn project(&self, view: &ConversationView) -> Result<usize> {
Ok(view.turns.len())
}
}Required Associated Types§
Sourcetype Output
type Output
The type produced by projecting a ConversationView.
Required Methods§
Sourcefn project(&self, view: &ConversationView) -> Result<Self::Output>
fn project(&self, view: &ConversationView) -> Result<Self::Output>
Project view into Self::Output.