pub struct Simulation { /* private fields */ }Expand description
Builder for a multi-node simulation topology.
Nodes and links are registered, then start instantiates
all engines, creates SimFaces, installs routes, and returns a
RunningSimulation handle.
Implementations§
Source§impl Simulation
impl Simulation
pub fn new() -> Self
Sourcepub fn channel_buffer(self, size: usize) -> Self
pub fn channel_buffer(self, size: usize) -> Self
Set the channel buffer size for SimLinks (default: 256).
Sourcepub fn add_node(&mut self, config: EngineConfig) -> NodeId
pub fn add_node(&mut self, config: EngineConfig) -> NodeId
Add a forwarding node and return its handle.
Sourcepub fn link(&mut self, a: NodeId, b: NodeId, config: LinkConfig)
pub fn link(&mut self, a: NodeId, b: NodeId, config: LinkConfig)
Connect two nodes with a symmetric link.
Sourcepub fn add_route(&mut self, node: NodeId, prefix: &str, nexthop_node: NodeId)
pub fn add_route(&mut self, node: NodeId, prefix: &str, nexthop_node: NodeId)
Pre-install a FIB route: packets for prefix at node are forwarded
toward nexthop_node (via the SimLink face connecting them).
Sourcepub async fn start(self) -> Result<RunningSimulation>
pub async fn start(self) -> Result<RunningSimulation>
Instantiate all engines, create links, install routes, and start.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Simulation
impl RefUnwindSafe for Simulation
impl Send for Simulation
impl Sync for Simulation
impl Unpin for Simulation
impl UnwindSafe for Simulation
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