pub struct SimulationBuilder { /* private fields */ }Expand description
Builder for configuring and constructing a simulation.
Use the builder methods to add process pools, set network topology,
configure bandwidth, choose an execution mode (single-threaded or parallel),
and finally call SimulationBuilder::build to obtain a runnable simulation.
Implementations§
Source§impl SimulationBuilder
impl SimulationBuilder
Sourcepub fn add_pool<P: ProcessHandle + Default + Send + 'static>(
self,
name: &str,
size: usize,
) -> SimulationBuilder
pub fn add_pool<P: ProcessHandle + Default + Send + 'static>( self, name: &str, size: usize, ) -> SimulationBuilder
Creates a named pool of size processes of type P.
Every process is also added to GLOBAL_POOL.
Sourcepub fn time_budget(self, time_budget: Jiffies) -> Self
pub fn time_budget(self, time_budget: Jiffies) -> Self
Sets the maximum simulation duration. The simulation stops when this time is reached.
Sourcepub fn within_pool_latency(self, pool: &str, distr: Distributions) -> Self
pub fn within_pool_latency(self, pool: &str, distr: Distributions) -> Self
Configures latency between processes within the same named pool.
Sourcepub fn between_pool_latency(
self,
from: &str,
to: &str,
distr: Distributions,
) -> Self
pub fn between_pool_latency( self, from: &str, to: &str, distr: Distributions, ) -> Self
Configures latency between processes in two different pools (symmetric).
Sourcepub fn vnic_bandwidth(self, bandwidth: BandwidthConfig) -> Self
pub fn vnic_bandwidth(self, bandwidth: BandwidthConfig) -> Self
Configures per-process NIC bandwidth limits.
Sourcepub fn parallel(self, threads: Threads) -> Self
pub fn parallel(self, threads: Threads) -> Self
Selects parallel execution mode using the given number of worker threads.
Sourcepub fn build(self) -> Box<dyn SimulationRunner>
pub fn build(self) -> Box<dyn SimulationRunner>
Finalizes configuration and builds the simulation runner.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimulationBuilder
impl !RefUnwindSafe for SimulationBuilder
impl Send for SimulationBuilder
impl !Sync for SimulationBuilder
impl Unpin for SimulationBuilder
impl UnsafeUnpin for SimulationBuilder
impl !UnwindSafe for SimulationBuilder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more