Trait tauri::command::CommandArg
pub trait CommandArg<'de, R: Runtime>: Sized {
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 ArgumentsA 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 ImplementationsTauri implements CommandArg
automatically for a number of types.
T where T: serde::Deserialize
- Any type that implements
Deserialize
can automatically be used as aCommandArg
.
- Any type that implements
#
Required methodsfrom_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>[src]#
fnDerives an instance of Self
from the CommandItem
.
If the derivation fails, the corresponding message will be rejected using InvokeMessage
.
#
ImplementorsDeserialize<'de>, R: Runtime> CommandArg<'de, R> for D[src]#
impl<'de, D:Automatically implement CommandArg
for any type that can be deserialized.
from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>#
fnRuntime> CommandArg<'de, R> for AppHandle<R>[src]#
impl<'de, R:from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>[src]#
fnGrabs the Window
from the CommandItem
and returns the associated AppHandle
. This will never fail.
Runtime> CommandArg<'de, R> for Window<R>[src]#
impl<'de, R:from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>[src]#
fnGrabs the Window
from the CommandItem
. This will never fail.
Send + Sync + 'static, R: Runtime> CommandArg<'de, R> for State<'r, T>[src]#
impl<'r, 'de: 'r, T:from_command(command: CommandItem<'de, R>) -> Result<Self, InvokeError>[src]#
fnGrabs the State
from the CommandItem
. This will never fail.