pub struct ExtensionBuilder { /* private fields */ }
Expand description

Used to build an extension.

Implementations§

source§

impl ExtensionBuilder

source

pub fn version(self, version: String) -> Self

Sets the version of the extension.

Examples found in repository?
examples/hello_world.rs (line 6)
4
5
6
7
8
9
10
fn init() -> Extension {
    Extension::build()
        .version("1.0.0".to_string())
        .command("hello", hello)
        .command("welcome", welcome)
        .finish()
}
source

pub fn group<S>(self, name: S, group: Group) -> Selfwhere S: Into<String>,

Add a group to the extension.

source

pub fn state<T>(self, state: T) -> Selfwhere T: Send + Sync + 'static,

Add a new state value to the extension if it has not be added already

source

pub fn freeze_state(self) -> Self

Freeze the extension’s state, preventing the state from changing, allowing for faster reads

source

pub const fn allow_no_args(self) -> Self

Allows the extension to be called without any arguments. Example:

"my_ext" callExtension "my_func"
source

pub fn command<S, F, I, R>(self, name: S, handler: F) -> Selfwhere S: Into<String>, F: Factory<I, R> + 'static,

Add a command to the extension.

Examples found in repository?
examples/hello_world.rs (line 7)
4
5
6
7
8
9
10
fn init() -> Extension {
    Extension::build()
        .version("1.0.0".to_string())
        .command("hello", hello)
        .command("welcome", welcome)
        .finish()
}
source

pub fn finish(self) -> Extension

Builds the extension.

Examples found in repository?
examples/hello_world.rs (line 9)
4
5
6
7
8
9
10
fn init() -> Extension {
    Extension::build()
        .version("1.0.0".to_string())
        .command("hello", hello)
        .command("welcome", welcome)
        .finish()
}

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.