pub struct Map { /* private fields */ }Expand description
Map composition - transform results
Applies a transformation function to the result of a composition, allowing post-processing of tool outputs.
§Example
ⓘ
let map = Map::new(
read_file_composition,
|result| {
ToolResult {
success: result.success,
result: result.result.to_uppercase(),
display_preference: None,
}
},
);Implementations§
Source§impl Map
impl Map
Sourcepub fn new(
composition: impl Composition + 'static,
transform: impl Fn(ToolResult) -> ToolResult + Send + Sync + 'static,
) -> Self
pub fn new( composition: impl Composition + 'static, transform: impl Fn(ToolResult) -> ToolResult + Send + Sync + 'static, ) -> Self
Creates a new map composition
§Arguments
composition- The composition to transformtransform- Function to apply to the result
Trait Implementations§
Source§impl Composition for Map
impl Composition for Map
Auto Trait Implementations§
impl Freeze for Map
impl !RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnsafeUnpin for Map
impl !UnwindSafe for Map
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