pub trait PromptLayerSink: Sized {
// Required method
fn prompt_layer_mut(&mut self) -> &mut PromptLayer;
// Provided methods
fn prompt_template(self, template: PromptTemplate) -> Self { ... }
fn prompt_contribution(self, contribution: PromptContribution) -> Self { ... }
fn replace_prompt_slot(
self,
slot: PromptSlot,
contributions: impl IntoIterator<Item = PromptContribution>,
) -> Self { ... }
fn clear_prompt_slot(self, slot: PromptSlot) -> Self { ... }
fn prompt_layer(self, layer: PromptLayer) -> Self { ... }
}Expand description
Builder-agnostic prompt-layer mutation surface.
Every builder that owns a PromptLayer — crate::LashCoreBuilder (the
runtime default prompt) and crate::SessionBuilder (the per-session
prompt) — implements this trait by exposing its layer via
prompt_layer_mut. The
template/contribution/slot operations are then defined here exactly once,
instead of being copy-pasted per builder.
(The per-turn TurnBuilder does not implement this trait: its prompt
operations forward to the turn context, which owns that logic, so there is
nothing to share.)
Required Methods§
Sourcefn prompt_layer_mut(&mut self) -> &mut PromptLayer
fn prompt_layer_mut(&mut self) -> &mut PromptLayer
Mutable access to the builder’s prompt layer, created on first use.
Provided Methods§
Sourcefn prompt_template(self, template: PromptTemplate) -> Self
fn prompt_template(self, template: PromptTemplate) -> Self
Set the base prompt template.
Sourcefn prompt_contribution(self, contribution: PromptContribution) -> Self
fn prompt_contribution(self, contribution: PromptContribution) -> Self
Add a single prompt contribution to its slot.
Sourcefn replace_prompt_slot(
self,
slot: PromptSlot,
contributions: impl IntoIterator<Item = PromptContribution>,
) -> Self
fn replace_prompt_slot( self, slot: PromptSlot, contributions: impl IntoIterator<Item = PromptContribution>, ) -> Self
Replace all contributions in a slot.
Sourcefn clear_prompt_slot(self, slot: PromptSlot) -> Self
fn clear_prompt_slot(self, slot: PromptSlot) -> Self
Clear all contributions from a slot.
Sourcefn prompt_layer(self, layer: PromptLayer) -> Self
fn prompt_layer(self, layer: PromptLayer) -> Self
Replace the whole prompt layer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".