create_memo

Function create_memo 

Source
pub fn create_memo<F, Out>(derived: F) -> StateHandle<Out>
where F: Fn() -> Out + 'static, Out: 'static,
Expand description

Creates a memoized value from some signals. Also know as “derived stores”.

§Example

use maple_core::prelude::*;

let state = Signal::new(0);

let double = create_memo(cloned!((state) => move || *state.get() * 2));
assert_eq!(*double.get(), 0);

state.set(1);
assert_eq!(*double.get(), 2);