pub struct Loop {
pub body: Box<Composable>,
pub max: u32,
pub until: Option<LoopPredicate>,
}Expand description
Loop: repeat an agent or pipeline up to max times, or until a predicate.
Fields§
§body: Box<Composable>The composable to repeat.
max: u32Maximum number of iterations.
until: Option<LoopPredicate>Optional early-exit predicate evaluated after each iteration.
Implementations§
Source§impl Loop
impl Loop
Sourcepub fn builder(_name: &str) -> Self
pub fn builder(_name: &str) -> Self
Create a loop builder with a body agent and default max iterations.
ⓘ
Loop::builder("refine")
.step(refine_agent)
.max_iterations(5)Sourcepub fn step(self, agent: impl Into<Composable>) -> Self
pub fn step(self, agent: impl Into<Composable>) -> Self
Set the body composable to loop over.
Sourcepub fn max_iterations(self, n: u32) -> Self
pub fn max_iterations(self, n: u32) -> Self
Set a maximum number of iterations.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Loop
impl !RefUnwindSafe for Loop
impl Send for Loop
impl Sync for Loop
impl Unpin for Loop
impl !UnwindSafe for Loop
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