pub struct Handle {
pub id: HandleId,
pub handle_type: HandleType,
pub position: HandlePosition,
pub connection_limit: Option<usize>,
pub valid_connection_types: Option<Vec<String>>,
pub style: Option<String>,
}Expand description
Connection handle on a node
Fields§
§id: HandleId§handle_type: HandleType§position: HandlePosition§connection_limit: Option<usize>§valid_connection_types: Option<Vec<String>>§style: Option<String>Implementations§
Source§impl Handle
impl Handle
Sourcepub fn new(
id: impl Into<HandleId>,
handle_type: HandleType,
position: HandlePosition,
) -> Self
pub fn new( id: impl Into<HandleId>, handle_type: HandleType, position: HandlePosition, ) -> Self
Create a new handle
Sourcepub fn source(id: impl Into<HandleId>, position: HandlePosition) -> Self
pub fn source(id: impl Into<HandleId>, position: HandlePosition) -> Self
Create a source handle
Sourcepub fn target(id: impl Into<HandleId>, position: HandlePosition) -> Self
pub fn target(id: impl Into<HandleId>, position: HandlePosition) -> Self
Create a target handle
Sourcepub fn with_connection_limit(self, limit: usize) -> Self
pub fn with_connection_limit(self, limit: usize) -> Self
Set connection limit
Sourcepub fn with_connection_types(self, types: Vec<String>) -> Self
pub fn with_connection_types(self, types: Vec<String>) -> Self
Set valid connection types
Sourcepub fn with_style(self, style: impl Into<String>) -> Self
pub fn with_style(self, style: impl Into<String>) -> Self
Set style
Sourcepub fn absolute_position(&self, node_pos: Position, node_size: Size) -> Position
pub fn absolute_position(&self, node_pos: Position, node_size: Size) -> Position
Calculate absolute position of handle given node position and size
Sourcepub fn contains_point(
&self,
point: Position,
node_pos: Position,
node_size: Size,
handle_size: f64,
) -> bool
pub fn contains_point( &self, point: Position, node_pos: Position, node_size: Size, handle_size: f64, ) -> bool
Check if a point is within the handle’s bounds
Sourcepub fn can_connect_to(&self, other: &Handle) -> bool
pub fn can_connect_to(&self, other: &Handle) -> bool
Check if this handle can connect to another handle
Trait Implementations§
impl StructuralPartialEq for Handle
Auto Trait Implementations§
impl Freeze for Handle
impl RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnwindSafe for Handle
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