pub struct Force<N, E, Ty = Undirected> {
pub dict: LinkedHashMap<String, Value>,
pub dict_default: LinkedHashMap<String, Value>,
pub name: &'static str,
pub continuous: bool,
pub info: Option<&'static str>,
pub update: fn(dict: &LinkedHashMap<String, Value>, graph: &mut ForceGraph<N, E, Ty>, dt: f32),
}
Expand description
A struct that defines how your force behaves.
Fields§
§dict: LinkedHashMap<String, Value>
Current dictionary
dict_default: LinkedHashMap<String, Value>
Default dictionary
name: &'static str
Name of the force
continuous: bool
Whether or not the force should be run on each frame.
info: Option<&'static str>
A short description of the force.
update: fn(dict: &LinkedHashMap<String, Value>, graph: &mut ForceGraph<N, E, Ty>, dt: f32)
Force callback function.
Implementations§
Source§impl<N, E, Ty> Force<N, E, Ty>
impl<N, E, Ty> Force<N, E, Ty>
Sourcepub fn update(&self, graph: &mut ForceGraph<N, E, Ty>, dt: f32)
pub fn update(&self, graph: &mut ForceGraph<N, E, Ty>, dt: f32)
Update the graph’s node’s positions for a given interval.
Sourcepub fn dict_mut(&mut self) -> &mut LinkedHashMap<String, Value>
pub fn dict_mut(&mut self) -> &mut LinkedHashMap<String, Value>
Retrieve a mutable reference to the force’s internal dictionary.
Sourcepub fn dict(&self) -> &LinkedHashMap<String, Value>
pub fn dict(&self) -> &LinkedHashMap<String, Value>
Retrieve a reference to the force’s internal dictionary.
Sourcepub fn continuous(&self) -> bool
pub fn continuous(&self) -> bool
Retrieve if the force is continuous. Continuous forces run their update on every frame, non-continuous forces run their update every time the user clicks a “Run” button.
Trait Implementations§
Auto Trait Implementations§
impl<N, E, Ty> Freeze for Force<N, E, Ty>
impl<N, E, Ty> RefUnwindSafe for Force<N, E, Ty>
impl<N, E, Ty> Send for Force<N, E, Ty>
impl<N, E, Ty> Sync for Force<N, E, Ty>
impl<N, E, Ty> Unpin for Force<N, E, Ty>
impl<N, E, Ty> UnwindSafe for Force<N, E, Ty>
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