[−][src]Trait smart_access::BatchRt
A runtime batch. Requires batch_rt
feature.
See basic usage guide here.
Allows one to write batch transformers without specifying complex return types.
use smart_access::{ BatchRt, Cps }; fn add_inc(batch: impl BatchRt<i32, ()>) -> impl BatchRt<i32, ()> { batch.add(|x, _| { *x = *x + 1; }) } let mut foo = 1; add_inc(add_inc(foo.batch_rt())).run(); assert!(foo == 3);
Required methods
fn add<G>(self, g: G) -> Self where
G: FnOnce(&mut View, Option<R>) -> R + 'static,
G: FnOnce(&mut View, Option<R>) -> R + 'static,
Adds a new function to a runtime batch.
fn clear(self) -> Self
Clears a runtime batch.
fn pop(
self,
dst: Option<&mut Option<Box<dyn FnOnce(&mut View, Option<R>) -> R>>>
) -> Self
self,
dst: Option<&mut Option<Box<dyn FnOnce(&mut View, Option<R>) -> R>>>
) -> Self
Takes the last function from a runtime batch.
fn edit(&mut self) -> &mut Vec<Box<dyn FnOnce(&mut View, Option<R>) -> R>>
A direct access to the underlying vector.
Provided methods
Loading content...Implementors
impl<CPS: Cps, R> BatchRt<<CPS as Cps>::View, R> for CpsBatch<CPS, Vec<Box<dyn FnOnce(&mut CPS::View, Option<R>) -> R>>>
[src]
fn add<G>(self, g: G) -> Self where
G: FnOnce(&mut CPS::View, Option<R>) -> R + 'static,
[src]
G: FnOnce(&mut CPS::View, Option<R>) -> R + 'static,
fn clear(self) -> Self
[src]
fn pop(
self,
dst: Option<&mut Option<Box<dyn FnOnce(&mut CPS::View, Option<R>) -> R>>>
) -> Self
[src]
self,
dst: Option<&mut Option<Box<dyn FnOnce(&mut CPS::View, Option<R>) -> R>>>
) -> Self