pub trait CommandTrait: 'static {
// Required methods
fn name(&self) -> Name;
fn inputs(&self) -> Vec<CmdInputDescription>;
fn outputs(&self) -> Vec<CmdOutputDescription>;
fn run<'life0, 'async_trait>(
&'life0 self,
ctx: CommandContext,
params: ValueSet,
) -> Pin<Box<dyn Future<Output = Result<ValueSet, CommandError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn instruction_info(&self) -> Option<InstructionInfo> { ... }
fn permissions(&self) -> Permissions { ... }
fn destroy<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn read_form_data(&self, data: Value) -> ValueSet { ... }
fn passthrough_outputs(&self, inputs: &ValueSet) -> ValueSet { ... }
fn input_is_required(&self, name: &str) -> Option<bool> { ... }
fn output_is_optional(&self, name: &str) -> Option<bool> { ... }
}Expand description
Generic trait for implementing commands.
Required Methods§
Sourcefn inputs(&self) -> Vec<CmdInputDescription>
fn inputs(&self) -> Vec<CmdInputDescription>
List of inputs that the command can receive.
Sourcefn outputs(&self) -> Vec<CmdOutputDescription>
fn outputs(&self) -> Vec<CmdOutputDescription>
List of outputs that the command will return.
Sourcefn run<'life0, 'async_trait>(
&'life0 self,
ctx: CommandContext,
params: ValueSet,
) -> Pin<Box<dyn Future<Output = Result<ValueSet, CommandError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
ctx: CommandContext,
params: ValueSet,
) -> Pin<Box<dyn Future<Output = Result<ValueSet, CommandError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Run the command.
Provided Methods§
Sourcefn instruction_info(&self) -> Option<InstructionInfo>
fn instruction_info(&self) -> Option<InstructionInfo>
Specify if and how would this command output Solana instructions.
Sourcefn permissions(&self) -> Permissions
fn permissions(&self) -> Permissions
Specify requested permissions of this command.
Sourcefn destroy<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn destroy<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Async Drop method.
Sourcefn read_form_data(&self, data: Value) -> ValueSet
fn read_form_data(&self, data: Value) -> ValueSet
Specify how form_data are read.
Sourcefn passthrough_outputs(&self, inputs: &ValueSet) -> ValueSet
fn passthrough_outputs(&self, inputs: &ValueSet) -> ValueSet
Specify how to convert inputs into passthrough outputs.