pub struct Universe { /* private fields */ }
Expand description
Universe serves as the top-level context in which Actor can be spawned. It is not a singleton. A typical application will usually have only one universe hosting all of the actors but it is not a requirement.
In particular, unit test all have their own universe and hence can be executed in parallel.
Implementations§
Source§impl Universe
impl Universe
pub fn kill(&self)
Sourcepub async fn simulate_time_shift(&self, duration: Duration)
pub async fn simulate_time_shift(&self, duration: Duration)
Simulate advancing the time for unit tests.
It is not just about jumping the clock and triggering one round of messages: These message might have generated more messages for instance.
This simulation triggers progress step by step, and after each step, leaves 100ms for actors to schedule extra messages.
pub fn spawn_actor<A: Actor>(&self, actor: A) -> SpawnBuilder<A>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Universe
impl RefUnwindSafe for Universe
impl Send for Universe
impl Sync for Universe
impl Unpin for Universe
impl UnwindSafe for Universe
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