pub struct FutureBuilder;Expand description
Builds from a future — the reference’s FutureBuilder, over
BuildContext::use_future.
use frus_widgets::{text, FutureBuilder};
let greeting = FutureBuilder::new(
"en",
|lang: &&str| {
let lang = *lang;
async move { if lang == "en" { "Hello" } else { "Bonjour" } }
},
|_, snapshot| Box::new(text(snapshot.data.unwrap_or("…"))),
);The future starts once, and again only when key changes.
Implementations§
Source§impl FutureBuilder
impl FutureBuilder
Auto Trait Implementations§
impl Freeze for FutureBuilder
impl RefUnwindSafe for FutureBuilder
impl Send for FutureBuilder
impl Sync for FutureBuilder
impl Unpin for FutureBuilder
impl UnsafeUnpin for FutureBuilder
impl UnwindSafe for FutureBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more