Skip to main content

Tool

Struct Tool 

Source
pub struct Tool {
    pub version: String,
    pub requires_filesystem: bool,
    pub commands: CommandTree,
    pub schema: SchemaGraph,
}
Expand description

Top-level tool metadata record.

Fields§

§version: String§requires_filesystem: bool§commands: CommandTree§schema: SchemaGraph

Named-type registry shared by this tool’s commands. Typed positions in the command tree may reference these definitions via SchemaType::Ref. Use SchemaGraph::empty when there are no shared definitions to declare.

The graph’s root field is a structurally-required placeholder (empty record); only defs is consumed. The real roots are the per-position embedded SchemaTypes.

Implementations§

Source§

impl Tool

Source

pub fn command_index_by_path(&self, command_path: &[String]) -> Option<usize>

Resolves a command-path (as passed to golem:tool invoke) to the index of the command node whose body it selects. An empty path selects the root command. Each segment matches a subcommand’s name or alias. Returns None when a segment does not match or the selected command has no body.

Source

pub fn effective_globals( &self, command_index: usize, ) -> Vec<EffectiveCommandField>

The inherited globals in scope for command_index, collected along the path from the root in path order (options before flags within each node).

Source

pub fn canonical_input_surfaces( &self, command_index: usize, ) -> Vec<CanonicalSurfaceRef>

The ordered canonical input surfaces of the command at command_index, identified by their position in the tool definition (see the module documentation for the ordering and shadowing rules).

This is the single source of the canonical field ordering: callers with richer per-surface data (such as the Rust SDK’s extended descriptor model) map each returned reference back onto their own structures by position, which stays unambiguous even for invalid tools with duplicate surface names.

Source

pub fn canonical_field_for_surface( &self, command_index: usize, surface: CanonicalSurfaceRef, ) -> Option<CanonicalInputField>

The canonical input field for one surface reference of the command at command_index, or None if the reference does not resolve.

Source

pub fn canonical_input_fields( &self, command_index: usize, ) -> Vec<CanonicalInputField>

The ordered canonical input fields of the command at command_index (see the module documentation for the ordering and shadowing rules).

Source

pub fn canonical_input_model( &self, command_index: usize, ) -> Result<CanonicalInputModel, ToolValidationError>

The canonical input model of the command at command_index: the ordered fields plus the self-contained record schema.

Source

pub fn canonical_input_record_schema( &self, command_index: usize, ) -> Result<SchemaGraph, ToolValidationError>

The self-contained record schema of the command’s canonical input: a record with one field per canonical input field, with the tool’s shared definitions projected to those reachable from the record.

Source

pub fn decode_canonical_input_record( &self, command_index: usize, value: SchemaValue, ) -> Result<Vec<CanonicalInputValue>, CanonicalInputDecodeError>

Decodes a canonical input record value against the command’s canonical input model.

Source§

impl Tool

Source

pub fn name(&self) -> Option<&str>

Returns the name of the tool: the name of the root node of its command tree.

Trait Implementations§

Source§

impl Clone for Tool

Source§

fn clone(&self) -> Tool

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tool

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Tool

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Tool, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FromSchema for Tool

Source§

impl IntoSchema for Tool

Source§

impl PartialEq for Tool

Source§

fn eq(&self, other: &Tool) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Tool

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Tool

Source§

impl TryFrom<&Tool> for Tool

Source§

fn try_from(tool: &Tool) -> Result<Tool, <Tool as TryFrom<&Tool>>::Error>

Encode a Tool into the flat golem:tool/common@0.1.0 wire form. The tool’s defs plus every type embedded in its command tree are folded into one shared wire::SchemaGraph.

Source§

type Error = ToolWitError

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

impl TryFrom<&Tool> for Tool

Source§

fn try_from(w: &Tool) -> Result<Tool, <Tool as TryFrom<&Tool>>::Error>

Decode a golem:tool/common@0.1.0 wire wire::Tool into the recursive Tool model.

Source§

type Error = ToolWitError

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl Freeze for Tool

§

impl RefUnwindSafe for Tool

§

impl Send for Tool

§

impl Sync for Tool

§

impl Unpin for Tool

§

impl UnsafeUnpin for Tool

§

impl UnwindSafe for Tool

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> IntoTypedSchemaValue for T
where T: IntoSchema + ?Sized,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Resource for T
where T: 'static,

Source§

type Rep = Option<T>

The type which is actually stored in-memory for this resource. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> TupleOrUnit<()> for T

Source§

fn into(self)