Skip to main content

Node

Struct Node 

Source
pub struct Node<T = ()> {
Show 14 fields pub id: Id, pub position: Point, pub label: String, pub data: T, pub node_type: Option<String>, pub source_side: Side, pub target_side: Side, pub draggable: bool, pub selectable: bool, pub selected: bool, pub size: Option<Size>, pub measured: Option<Size>, pub class: Option<String>, pub style: Option<String>,
}
Expand description

A node in the flow graph.

T is a user-defined payload available to custom node renderers.

Fields§

§id: Id§position: Point

Position of the node’s top-left corner, in flow coordinates.

§label: String

Label rendered by the default node view.

§data: T

Custom payload for custom node views.

§node_type: Option<String>

Node type tag. The default view recognizes "input" (source handle only) and "output" (target handle only); custom views can match on any value.

§source_side: Side

Side where outgoing edges leave (used by the default view’s source handle and as the anchor fallback).

§target_side: Side

Side where incoming edges arrive.

§draggable: bool§selectable: bool§selected: bool§size: Option<Size>

Explicit size. When None (default) the node sizes to its content and is measured automatically.

§measured: Option<Size>

Measured size, maintained by the framework.

§class: Option<String>

Extra CSS classes for the node wrapper (e.g. Tailwind utilities).

§style: Option<String>

Extra inline CSS for the node wrapper.

Implementations§

Source§

impl Node<()>

Source

pub fn new( id: impl Into<Id>, label: impl Into<String>, position: impl Into<Point>, ) -> Self

Create a node with the default (unit) payload.

Source§

impl<T> Node<T>

Source

pub fn with_data( id: impl Into<Id>, label: impl Into<String>, position: impl Into<Point>, data: T, ) -> Self

Create a node carrying a custom payload.

Source

pub fn node_type(self, ty: impl Into<String>) -> Self

Source

pub fn size(self, size: impl Into<Size>) -> Self

Source

pub fn class(self, class: impl Into<String>) -> Self

Source

pub fn style(self, style: impl Into<String>) -> Self

Source

pub fn draggable(self, draggable: bool) -> Self

Source

pub fn selectable(self, selectable: bool) -> Self

Source

pub fn sides(self, target: Side, source: Side) -> Self

Set both handle sides at once, e.g. for horizontal layouts sides(Side::Left, Side::Right) (incoming left, outgoing right).

Source

pub fn rect(&self) -> Rect

The node’s current rectangle (explicit size, else measured, else a default estimate).

Trait Implementations§

Source§

impl<T: Clone> Clone for Node<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Node<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq> PartialEq for Node<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq> 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> UnsafeUnpin for Node<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Node<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DependencyElement for T
where T: 'static + PartialEq + Clone,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more