Skip to main content

trait.CommandArg

pub trait CommandArg<'de, P: Params>: Sized {
    fn from_command(command: CommandItem<'de, P>) -> Result<Self, InvokeError>;
}

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.

Required methods#

fn from_command(command: CommandItem<'de, P>) -> Result<Self, InvokeError>#

Derives an instance of Self from the CommandItem.

If the derivation fails, the corresponding message will be rejected using InvokeMessage.

Loading content...

Implementors#

impl<'de, D: Deserialize<'de>, P: Params> CommandArg<'de, P> for D#

Automatically implement CommandArg for any type that can be deserialized.

fn from_command(command: CommandItem<'de, P>) -> Result<Self, InvokeError>#

impl<'de, P: Params> CommandArg<'de, P> for Window<P>#

fn from_command(command: CommandItem<'de, P>) -> Result<Self, InvokeError>#

Grabs the Window from the CommandItem. This will never fail.

impl<'r, 'de: 'r, T: Send + Sync + 'static, P: Params> CommandArg<'de, P> for State<'r, T>#

fn from_command(command: CommandItem<'de, P>) -> Result<Self, InvokeError>#

Grabs the State from the CommandItem. This will never fail.

Loading content...