pub struct PromptSection {
pub kind: PromptSectionKind,
pub content: String,
pub name: Option<String>,
pub adapter: Option<Arc<dyn Fn(&str) -> String + Send + Sync>>,
}Expand description
A section of a prompt.
Fields§
§kind: PromptSectionKindThe semantic category of this section.
content: StringThe text content of this section.
name: Option<String>Optional name for this section (used for name-based filtering/reordering).
adapter: Option<Arc<dyn Fn(&str) -> String + Send + Sync>>Optional adapter function for adaptive prompts.
Implementations§
Source§impl PromptSection
impl PromptSection
Sourcepub fn render_with_context(&self, ctx: &str) -> String
pub fn render_with_context(&self, ctx: &str) -> String
Render an adaptive section with a context string.
If this section has an adapter function, invokes it with the given context.
Otherwise, falls back to the normal render().
Trait Implementations§
Source§impl Add<PromptSection> for PromptComposite
impl Add<PromptSection> for PromptComposite
Source§type Output = PromptComposite
type Output = PromptComposite
The resulting type after applying the
+ operator.Source§impl Add for PromptSection
Compose two prompt sections with +.
impl Add for PromptSection
Compose two prompt sections with +.
Source§type Output = PromptComposite
type Output = PromptComposite
The resulting type after applying the
+ operator.Source§impl Clone for PromptSection
impl Clone for PromptSection
Source§fn clone(&self) -> PromptSection
fn clone(&self) -> PromptSection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PromptSection
impl Debug for PromptSection
Source§impl From<PromptSection> for String
impl From<PromptSection> for String
Source§fn from(s: PromptSection) -> String
fn from(s: PromptSection) -> String
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PromptSection
impl !RefUnwindSafe for PromptSection
impl Send for PromptSection
impl Sync for PromptSection
impl Unpin for PromptSection
impl !UnwindSafe for PromptSection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more