pub trait CommandArg<'de, R: Runtime>: Sized {
// Required method
fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>;
}Expand description
Trait implemented by command arguments to derive a value from a CommandItem.
§Command Arguments
A command argument is any type that represents an item parsable from a CommandItem. Most
implementations will use the data stored in InvokeMessage since CommandItem is mostly a
wrapper around it.
§Provided Implementations
Tauri implements CommandArg automatically for a number of types.
crate::Windowcrate::StateT where T: serde::Deserialize- Any type that implements
Deserializecan automatically be used as aCommandArg.
- Any type that implements
Required Methods§
Sourcefn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>
fn from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>
Derives an instance of Self from the CommandItem.
If the derivation fails, the corresponding message will be rejected using InvokeMessage.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<'a, R: Runtime> CommandArg<'a, R> for Request<'a>
impl<'a, R: Runtime, T: ScopeObject> CommandArg<'a, R> for CommandScope<T>
impl<'a, R: Runtime, T: ScopeObject> CommandArg<'a, R> for GlobalScope<T>
impl<'de, D: Deserialize<'de>, R: Runtime> CommandArg<'de, R> for D
Automatically implement CommandArg for any type that can be deserialized.