pub struct TestClientRuntime(/* private fields */);
Expand description
A runtime meant to be used for testing only. It uses a pool of runtimes, so that many runtimes can co-exist on one thread, but simulates running on a client.
use reactive_signals::{Scope, signal, runtimes::TestClientRuntime};
// when starting a client you create the root scope
let sc = TestClientRuntime::new_root_scope();
// this scope is then used for building a tree of scopes.
app(sc);
// calling discard() on the root scope will discard the TestClientRuntime as well.
sc.discard();
fn app(sc: Scope<TestClientRuntime>) {
// a signal marked with `server` will not run in a Scope<TestClientRuntime>
let sig = signal!(sc, server, move || println!("server!"));
}
See runtimes for full documentation.
Implementations§
Source§impl TestClientRuntime
impl TestClientRuntime
pub fn new_root_scope() -> Scope<TestClientRuntime>
Trait Implementations§
Source§impl Clone for TestClientRuntime
impl Clone for TestClientRuntime
Source§fn clone(&self) -> TestClientRuntime
fn clone(&self) -> TestClientRuntime
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for TestClientRuntime
impl Default for TestClientRuntime
Source§fn default() -> TestClientRuntime
fn default() -> TestClientRuntime
Returns the “default value” for a type. Read more
impl Copy for TestClientRuntime
Auto Trait Implementations§
impl Freeze for TestClientRuntime
impl RefUnwindSafe for TestClientRuntime
impl Send for TestClientRuntime
impl Sync for TestClientRuntime
impl Unpin for TestClientRuntime
impl UnwindSafe for TestClientRuntime
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