Struct Tool

Source
pub struct Tool<Name = String, Description = String> {
    pub name: Name,
    pub description: Description,
    /* private fields */
}

Fields§

§name: Name§description: Description

Implementations§

Source§

impl Tool<(), ()>

Source

pub unsafe fn new( input: Schema, output: Option<Schema>, call: impl Fn(Value) -> Result<Receiver<Action>> + Send + Sync + 'static, ) -> Self

§Safety

The input and output schemas must match the call implementation.

Source§

impl<Name, Description> Tool<Name, Description>

Source

pub fn name(self, name: impl AsRef<str>) -> Tool<String, Description>

Source

pub fn description(self, description: impl AsRef<str>) -> Tool<Name>

Source§

impl Tool

Source

pub fn input(&self) -> &Schema

Source

pub fn output(&self) -> Option<&Schema>

Source

pub fn call(&self, json: Value) -> Result<Receiver<Action>>

Auto Trait Implementations§

§

impl<Name, Description> Freeze for Tool<Name, Description>
where Name: Freeze, Description: Freeze,

§

impl<Name = String, Description = String> !RefUnwindSafe for Tool<Name, Description>

§

impl<Name, Description> Send for Tool<Name, Description>
where Name: Send, Description: Send,

§

impl<Name, Description> Sync for Tool<Name, Description>
where Name: Sync, Description: Sync,

§

impl<Name, Description> Unpin for Tool<Name, Description>
where Name: Unpin, Description: Unpin,

§

impl<Name = String, Description = String> !UnwindSafe for Tool<Name, Description>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.