Skip to main content

PluginBuilder

Struct PluginBuilder 

Source
pub struct PluginBuilder { /* private fields */ }
Expand description

Builder for the conduit Tauri v2 plugin.

Collects command registrations and configuration, then produces a TauriPlugin via build.

Implementations§

Source§

impl PluginBuilder

Source

pub fn new() -> Self

Create a new, empty plugin builder.

Source

pub fn command<F>(self, name: impl Into<String>, handler: F) -> Self
where F: Fn(Vec<u8>) -> Vec<u8> + Send + Sync + 'static,

Register a synchronous command handler.

The handler receives the raw request payload and must return the raw response payload. Command names correspond to the path segment in the conduit://localhost/invoke/<cmd_name> URL.

Source

pub fn channel(self, name: impl Into<String>) -> Self

Register a named ring buffer channel with the default capacity (64 KB).

The JS client can subscribe to push notifications for this channel, or poll it directly via conduit://localhost/drain/<name>.

Source

pub fn channel_with_capacity( self, name: impl Into<String>, capacity: usize, ) -> Self

Register a named ring buffer channel with a custom byte capacity.

Source

pub fn build<R: Runtime>(self) -> TauriPlugin<R>

Build the Tauri v2 plugin.

This consumes the builder and returns a TauriPlugin that can be passed to tauri::Builder::plugin.

Trait Implementations§

Source§

impl Debug for PluginBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PluginBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.