Struct fdg_sim::Simulation
source · [−]pub struct Simulation<N, E, Ty = Undirected> { /* private fields */ }Expand description
A simulation for managing the main event loop and forces.
Implementations
sourceimpl<N, E, Ty: EdgeType> Simulation<N, E, Ty>
impl<N, E, Ty: EdgeType> Simulation<N, E, Ty>
sourcepub fn from_graph(
graph: ForceGraph<N, E, Ty>,
parameters: SimulationParameters<N, E, Ty>
) -> Self
pub fn from_graph(
graph: ForceGraph<N, E, Ty>,
parameters: SimulationParameters<N, E, Ty>
) -> Self
Create a simulation from a ForceGraph.
sourcepub fn reset_node_placement(&mut self)
pub fn reset_node_placement(&mut self)
Randomly place the nodes within the starting square. In practice, this restarts the simulation.
sourcepub fn update_custom(&mut self, force: &Force<N, E, Ty>, dt: f32)
pub fn update_custom(&mut self, force: &Force<N, E, Ty>, dt: f32)
Update the graph’s node’s positions for a given interval with a custom Force.
sourcepub fn visit_nodes(&self, cb: &mut impl Fn(&Node<N>))
pub fn visit_nodes(&self, cb: &mut impl Fn(&Node<N>))
Run a callback on all the nodes.
sourcepub fn visit_edges(&self, cb: &mut impl Fn(&Node<N>, &Node<N>))
pub fn visit_edges(&self, cb: &mut impl Fn(&Node<N>, &Node<N>))
Run a callback on all of the edges.
sourcepub fn get_graph(&self) -> &ForceGraph<N, E, Ty>
pub fn get_graph(&self) -> &ForceGraph<N, E, Ty>
Retrieve a reference to the internal ForceGraph.
sourcepub fn get_graph_mut(&mut self) -> &mut ForceGraph<N, E, Ty>
pub fn get_graph_mut(&mut self) -> &mut ForceGraph<N, E, Ty>
Retrieve a mutable reference to the internal ForceGraph.
sourcepub fn set_graph(&mut self, graph: ForceGraph<N, E, Ty>)
pub fn set_graph(&mut self, graph: ForceGraph<N, E, Ty>)
Set the internal ForceGraph.
sourcepub fn parameters(&self) -> &SimulationParameters<N, E, Ty>
pub fn parameters(&self) -> &SimulationParameters<N, E, Ty>
Retrieve a reference to the internal SimulationParameters.
sourcepub fn parameters_mut(&mut self) -> &mut SimulationParameters<N, E, Ty>
pub fn parameters_mut(&mut self) -> &mut SimulationParameters<N, E, Ty>
Retreive a mutable reference to the internal SimulationParameters.
Trait Implementations
sourceimpl<N: Clone, E: Clone, Ty: Clone> Clone for Simulation<N, E, Ty>
impl<N: Clone, E: Clone, Ty: Clone> Clone for Simulation<N, E, Ty>
sourcefn clone(&self) -> Simulation<N, E, Ty>
fn clone(&self) -> Simulation<N, E, Ty>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations
impl<N, E, Ty> RefUnwindSafe for Simulation<N, E, Ty>where
E: RefUnwindSafe,
N: RefUnwindSafe,
Ty: RefUnwindSafe,
impl<N, E, Ty> Send for Simulation<N, E, Ty>where
E: Send,
N: Send,
Ty: Send,
impl<N, E, Ty> Sync for Simulation<N, E, Ty>where
E: Sync,
N: Sync,
Ty: Sync,
impl<N, E, Ty> Unpin for Simulation<N, E, Ty>where
E: Unpin,
N: Unpin,
Ty: Unpin,
impl<N, E, Ty> UnwindSafe for Simulation<N, E, Ty>where
E: UnwindSafe,
N: UnwindSafe,
Ty: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more