Struct tauri::ipc::JavaScriptChannelId
source · pub struct JavaScriptChannelId(/* private fields */);
Expand description
The ID of a channel that was defined on the JavaScript layer.
Useful when expecting Channel
as part of a JSON object instead of a top-level command argument.
§Examples
use tauri::{ipc::JavaScriptChannelId, Runtime, Webview};
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
struct Button {
label: String,
on_click: JavaScriptChannelId,
}
#[tauri::command]
fn add_button<R: Runtime>(webview: Webview<R>, button: Button) {
let channel = button.on_click.channel_on(webview);
channel.send("clicked").unwrap();
}
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for JavaScriptChannelId
impl<'de> Deserialize<'de> for JavaScriptChannelId
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for JavaScriptChannelId
impl RefUnwindSafe for JavaScriptChannelId
impl Send for JavaScriptChannelId
impl Sync for JavaScriptChannelId
impl Unpin for JavaScriptChannelId
impl UnwindSafe for JavaScriptChannelId
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more