pub struct ToolRegistration {
pub name: &'static str,
pub doc: &'static str,
pub f: fn(Value, Option<Arc<dyn Any + Send + Sync>>) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send>>,
pub param_schema: fn() -> Value,
pub meta_json: &'static str,
pub needs_ctx: bool,
pub ctx_type_id: Option<fn() -> TypeId>,
pub ctx_type_name: &'static str,
}Expand description
Tool registration for inventory collection. Constructed via struct literal in macro-generated code; field additions are minor-version breaking changes.
Fields§
§name: &'static str§doc: &'static str§f: fn(Value, Option<Arc<dyn Any + Send + Sync>>) -> Pin<Box<dyn Future<Output = Result<Value, ToolError>> + Send>>§param_schema: fn() -> Value§meta_json: &'static strJSON object literal of the attributes declared in #[tool(...)].
"{}" when no attributes were given. Deserialized into the
collection’s M at ToolCollection::collect_tools time.
needs_ctx: booltrue when the tool’s first parameter is named ctx.
ctx_type_id: Option<fn() -> TypeId>Returns the TypeId of the expected context type T (the inner
type of Arc<T>). None when needs_ctx is false.
ctx_type_name: &'static strHuman-readable name of the expected context type, for error
messages. Empty string when needs_ctx is false.
Trait Implementations§
impl Collect for ToolRegistration
Auto Trait Implementations§
impl Freeze for ToolRegistration
impl RefUnwindSafe for ToolRegistration
impl Send for ToolRegistration
impl Sync for ToolRegistration
impl Unpin for ToolRegistration
impl UnsafeUnpin for ToolRegistration
impl UnwindSafe for ToolRegistration
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