Struct sodium::SodiumCtx

source ·
pub struct SodiumCtx {
    pub impl_: SodiumCtx,
}
Expand description

A context object representing a specific instance of a Sodium system.

Fields§

§impl_: SodiumCtx

Implementations§

source§

impl SodiumCtx

source

pub fn new() -> SodiumCtx

Create a new Sodium FRP context.

source

pub fn new_cell<A: Clone + Send + 'static>(&self, a: A) -> Cell<A>

Create a new constant value Cell in this context.

source

pub fn new_stream<A: Clone + Send + 'static>(&self) -> Stream<A>

Create a new stream that will never fire in this context.

source

pub fn new_cell_sink<A: Clone + Send + 'static>(&self, a: A) -> CellSink<A>

Create a new CellSink for interfacing I/O and FRP.

source

pub fn new_stream_sink<A: Clone + Send + 'static>(&self) -> StreamSink<A>

Create a new StreamSink for interfacing I/O and FRP.

source

pub fn new_cell_loop<A: Clone + Send + 'static>(&self) -> CellLoop<A>

Create a new CellLoop to act as a forward reference for a Cell that will be created later.

source

pub fn new_stream_loop<A: Clone + Send + 'static>(&self) -> StreamLoop<A>

Create a new StreamLoop to act as a forward reference for a Stream that will be created later.

source

pub fn new_stream_sink_with_coalescer<A: Clone + Send + 'static, COALESCER: FnMut(&A, &A) -> A + Send + 'static>( &self, coalescer: COALESCER ) -> StreamSink<A>

Create a new StreamSink with a combining function that allows sending multiple event values per transaction.

source

pub fn transaction<R, K: FnOnce() -> R>(&self, k: K) -> R

Run the given function inside a single Sodium transaction, closing the transaction after the function returns.

source

pub fn new_transaction(&self) -> Transaction

Create a new scoped transaction object.

The Sodium transaction on this context will be held open until the returned Transaction is dropped or Transaction::close is called explicitly.

source

pub fn post<K: FnMut() + Send + 'static>(&self, k: K)

Execute the given code after the current transaction is closed, or immediately if there is no current transaction.

source

pub fn new_router<A, K>( &self, in_stream: &Stream<A>, selector: impl Fn(&A) -> Vec<K> + Send + Sync + 'static ) -> Router<A, K>
where A: Clone + Send + 'static, K: Send + Sync + Eq + Hash + 'static,

Create a new Router in this context.

Trait Implementations§

source§

impl Clone for SodiumCtx

source§

fn clone(&self) -> SodiumCtx

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for SodiumCtx

source§

fn default() -> SodiumCtx

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.