pub struct PromptComposite {
pub sections: Vec<PromptSection>,
}Expand description
A composed prompt built from multiple sections.
Fields§
§sections: Vec<PromptSection>The ordered list of prompt sections.
Implementations§
Source§impl PromptComposite
impl PromptComposite
Sourcepub fn only(self, kinds: &[PromptSectionKind]) -> Self
pub fn only(self, kinds: &[PromptSectionKind]) -> Self
Keep only sections of specified kinds.
Sourcepub fn without(self, kinds: &[PromptSectionKind]) -> Self
pub fn without(self, kinds: &[PromptSectionKind]) -> Self
Remove sections of specified kinds.
Sourcepub fn reorder(self, order: &[PromptSectionKind]) -> Self
pub fn reorder(self, order: &[PromptSectionKind]) -> Self
Reorder sections by kind priority.
Sourcepub fn reorder_by_name(self, order: &[&str]) -> Self
pub fn reorder_by_name(self, order: &[&str]) -> Self
Reorder sections by name. Sections matching the given names come first (in the specified order); unmatched sections are appended at the end in their original order.
Sourcepub fn only_by_name(self, names: &[&str]) -> Self
pub fn only_by_name(self, names: &[&str]) -> Self
Keep only sections whose names match the given list.
Sourcepub fn without_by_name(self, names: &[&str]) -> Self
pub fn without_by_name(self, names: &[&str]) -> Self
Remove sections whose names match the given list.
Sourcepub fn apply(self, transform: PromptTransform) -> Self
pub fn apply(self, transform: PromptTransform) -> Self
Apply a PromptTransform to this composite.
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 Clone for PromptComposite
impl Clone for PromptComposite
Source§fn clone(&self) -> PromptComposite
fn clone(&self) -> PromptComposite
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 PromptComposite
impl Debug for PromptComposite
Source§impl From<PromptComposite> for String
impl From<PromptComposite> for String
Source§fn from(p: PromptComposite) -> String
fn from(p: PromptComposite) -> String
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PromptComposite
impl !RefUnwindSafe for PromptComposite
impl Send for PromptComposite
impl Sync for PromptComposite
impl Unpin for PromptComposite
impl !UnwindSafe for PromptComposite
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