Skip to main content

SimplexCliBuilder

Struct SimplexCliBuilder 

Source
pub struct SimplexCliBuilder<I = Empty<OsString>> { /* private fields */ }
Expand description

Builder for SimplexCli.

Obtained via SimplexCli::builder.

§Example

let cli = SimplexCli::builder("Bot", 5225)
    .db_prefix("/var/db/simplex")
    .db_key(secret)
    .arg("--smp-servers=smp://example.com")
    .spawn()
    .await?;

Implementations§

Source§

impl<I> SimplexCliBuilder<I>
where I: Iterator<Item = OsString>,

Source

pub fn db_prefix(self, path: impl Into<String>) -> SimplexCliBuilder<I>

Sets the path to the SimpleX database directory (defaults to ".").

Source

pub fn db_key(self, key: impl Into<String>) -> SimplexCliBuilder<I>

Passes a database encryption key via the -k flag.

Source

pub fn arg( self, arg: impl Into<OsString>, ) -> SimplexCliBuilder<Chain<I, Once<OsString>>>

Adds an extra command argument

Source

pub fn args<J>( self, args: J, ) -> SimplexCliBuilder<Chain<I, <J as IntoIterator>::IntoIter>>
where J: IntoIterator<Item = OsString>,

Adds multiple extra command arguments

Source

pub async fn spawn(self) -> Result<SimplexCli, Error>

Spawns the simplex-chat process and returns a SimplexCli handle.

Checks the installed CLI version against the supported range before spawning.

Auto Trait Implementations§

§

impl<I> Freeze for SimplexCliBuilder<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for SimplexCliBuilder<I>
where I: RefUnwindSafe,

§

impl<I> Send for SimplexCliBuilder<I>
where I: Send,

§

impl<I> Sync for SimplexCliBuilder<I>
where I: Sync,

§

impl<I> Unpin for SimplexCliBuilder<I>
where I: Unpin,

§

impl<I> UnsafeUnpin for SimplexCliBuilder<I>
where I: UnsafeUnpin,

§

impl<I> UnwindSafe for SimplexCliBuilder<I>
where I: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V