Struct viewbuilder::Runtime
source · pub struct Runtime { /* private fields */ }Implementations§
source§impl Runtime
impl Runtime
sourcepub fn enter(&self) -> RuntimeGuard
pub fn enter(&self) -> RuntimeGuard
Examples found in repository?
examples/counter.rs (line 23)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
async fn main() {
let rt = Runtime::default();
let _guard = rt.enter();
let a = Counter::default().spawn();
let b = Counter::default().spawn();
a.value_changed().bind(&b, Counter::set);
a.set(2);
rt.run().await;
assert_eq!(a.borrow().value, 2);
assert_eq!(b.borrow().value, 2);
}pub fn current() -> Self
pub fn try_current() -> Option<Self>
pub fn emit(&self, msg: Box<dyn Any>)
pub fn send(&self, key: DefaultKey, msg: Box<dyn Any>)
sourcepub async fn run(&self)
pub async fn run(&self)
Examples found in repository?
examples/counter.rs (line 31)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
async fn main() {
let rt = Runtime::default();
let _guard = rt.enter();
let a = Counter::default().spawn();
let b = Counter::default().spawn();
a.value_changed().bind(&b, Counter::set);
a.set(2);
rt.run().await;
assert_eq!(a.borrow().value, 2);
assert_eq!(b.borrow().value, 2);
}pub fn try_run(&self)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Runtime
impl !Send for Runtime
impl !Sync for Runtime
impl Unpin for Runtime
impl !UnwindSafe for Runtime
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