pub struct PluginState<R: Runtime> { /* private fields */ }Expand description
Shared state for the conduit Tauri plugin.
Holds the dispatch table, named ring buffer channels, the per-launch invoke key, and the app handle for emitting push notifications.
Implementations§
Source§impl<R: Runtime> PluginState<R>
impl<R: Runtime> PluginState<R>
Sourcepub fn channel(&self, name: &str) -> Option<&Arc<RingBuffer>>
pub fn channel(&self, name: &str) -> Option<&Arc<RingBuffer>>
Get a ring buffer channel by name (for pushing data from Rust handlers).
Sourcepub fn push(&self, channel: &str, data: &[u8]) -> Result<(), String>
pub fn push(&self, channel: &str, data: &[u8]) -> Result<(), String>
Push binary data to a named ring buffer channel and notify JS listeners.
After writing to the ring buffer, emits a conduit:data-available event
with the channel name as payload. JS subscribers receive this event and
auto-drain the binary data via the custom protocol endpoint.
Sourcepub fn channel_names(&self) -> Vec<String>
pub fn channel_names(&self) -> Vec<String>
Return the list of registered channel names.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for PluginState<R>
impl<R> !RefUnwindSafe for PluginState<R>
impl<R> Send for PluginState<R>
impl<R> Sync for PluginState<R>
impl<R> Unpin for PluginState<R>
impl<R> UnsafeUnpin for PluginState<R>
impl<R> !UnwindSafe for PluginState<R>
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