Fusuma

Components / Lists and updates

lazy

build(), called only when key is not what it was.

How it looks

Drawn by the toolkit from the example below. No page of the gallery uses lazy yet, so there is nothing to run.

lazy drawn by Fusuma

build(), called only when key is not what it was.

Signature

pub fn lazy<K: core::hash::Hash + ?Sized, F>(key: &K, build: F) -> Lazy<F>

Example

use fusuma::{lazy, text};
let user = "Ada";
let view = lazy(&user, || text("Hello, Ada"));
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.texts(), ["Hello, Ada"]);

All components · Source