pub struct Node<T = ()> {Show 15 fields
pub id: NodeId,
pub position: Position,
pub size: Size,
pub data: T,
pub node_type: Option<String>,
pub selected: bool,
pub dragging: bool,
pub selectable: bool,
pub connectable: bool,
pub deletable: bool,
pub drag_handle: Option<String>,
pub parent_node: Option<NodeId>,
pub z_index: Option<i32>,
pub hidden: bool,
pub measured: Option<Size>,
/* private fields */
}Expand description
Node in a flow graph
Fields§
§id: NodeId§position: Position§size: Size§data: T§node_type: Option<String>§selected: bool§dragging: bool§selectable: bool§connectable: bool§deletable: bool§drag_handle: Option<String>§parent_node: Option<NodeId>§z_index: Option<i32>§measured: Option<Size>Implementations§
Source§impl<T: Clone> Node<T>
impl<T: Clone> Node<T>
Sourcepub fn builder(id: impl Into<NodeId>) -> NodeBuilder<T>where
T: Default,
pub fn builder(id: impl Into<NodeId>) -> NodeBuilder<T>where
T: Default,
Create a builder for fluent construction
Sourcepub fn contains_point(&self, point: Position) -> bool
pub fn contains_point(&self, point: Position) -> bool
Check if point is inside the node
Sourcepub fn set_position(&mut self, position: Position)
pub fn set_position(&mut self, position: Position)
Update position
Sourcepub fn set_selected(&mut self, selected: bool)
pub fn set_selected(&mut self, selected: bool)
Set selection state
Sourcepub fn set_dragging(&mut self, dragging: bool)
pub fn set_dragging(&mut self, dragging: bool)
Set dragging state
Source§impl<T> Node<T>
impl<T> Node<T>
Sourcepub fn add_handle(&mut self, handle: Handle) -> Result<()>
pub fn add_handle(&mut self, handle: Handle) -> Result<()>
Add a handle to this node
Sourcepub fn remove_handle(&mut self, handle_id: &HandleId) -> Result<Handle>
pub fn remove_handle(&mut self, handle_id: &HandleId) -> Result<Handle>
Remove a handle from this node
Sourcepub fn get_handle(&self, handle_id: &HandleId) -> Option<&Handle>
pub fn get_handle(&self, handle_id: &HandleId) -> Option<&Handle>
Get a handle by ID
Sourcepub fn handle_at_position(
&self,
point: Position,
handle_size: f64,
) -> Option<&Handle>
pub fn handle_at_position( &self, point: Position, handle_size: f64, ) -> Option<&Handle>
Find handle at position relative to this node
Sourcepub fn source_handles(&self) -> impl Iterator<Item = &Handle>
pub fn source_handles(&self) -> impl Iterator<Item = &Handle>
Get source handles
Sourcepub fn target_handles(&self) -> impl Iterator<Item = &Handle>
pub fn target_handles(&self) -> impl Iterator<Item = &Handle>
Get target handles
Trait Implementations§
impl<T> StructuralPartialEq for Node<T>
Auto Trait Implementations§
impl<T> Freeze for Node<T>where
T: Freeze,
impl<T> RefUnwindSafe for Node<T>where
T: RefUnwindSafe,
impl<T> Send for Node<T>where
T: Send,
impl<T> Sync for Node<T>where
T: Sync,
impl<T> Unpin for Node<T>where
T: Unpin,
impl<T> UnwindSafe for Node<T>where
T: UnwindSafe,
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