Struct NodeConstructor

Source
pub struct NodeConstructor<'a> { /* private fields */ }
Expand description

Used to construct a node and stores the relevant ui code for its title and attributes This is used so that the nodes can be rendered in the context depth order

Implementations§

Source§

impl<'a, 'b> NodeConstructor<'a>

Source

pub fn new(id: usize, args: NodeArgs) -> Self

Create a new node to be displayed in a Context. id should be the same accross frames and should not be the same as any other currently used nodes

Source

pub fn with_title(self, title: impl FnOnce(&mut Ui) -> Response + 'a) -> Self

Add a title to a node

Source

pub fn with_input_attribute( self, id: usize, args: PinArgs, attribute: impl FnOnce(&mut Ui) -> Response + 'a, ) -> Self

Add an input attibute to a node, this attribute can be connected to output attributes of other nodes id should be the same accross frames and should not be the same as any other currently used attributes the attribute should return a egui::Response to be checked for interaction

Source

pub fn with_output_attribute( self, id: usize, args: PinArgs, attribute: impl FnOnce(&mut Ui) -> Response + 'a, ) -> Self

Add an output attibute to a node, this attribute can be connected to input attributes of other nodes id should be the same accross frames and should not be the same as any other currently used attributes the attribute should return a egui::Response to be checked for interaction

Source

pub fn with_static_attribute( self, id: usize, attribute: impl FnOnce(&mut Ui) -> Response + 'a, ) -> Self

Add a static attibute to a node, this attribute can’t be connected to any other attributes id should be the same accross frames and should not be the same as any other currently used attributes the attribute should return a egui::Response to be checked for interaction

Source

pub fn with_origin(self, origin: Pos2) -> Self

Set the position of the node in screen space when it is first created. To modify it after creation use one of the set_node_pos methods of the Context

Source

pub fn id(&self) -> usize

Get the id of this NodeConstructor

Trait Implementations§

Source§

impl<'a> Debug for NodeConstructor<'a>

Source§

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

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

impl<'a> Default for NodeConstructor<'a>

Source§

fn default() -> NodeConstructor<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for NodeConstructor<'a>

§

impl<'a> !RefUnwindSafe for NodeConstructor<'a>

§

impl<'a> !Send for NodeConstructor<'a>

§

impl<'a> !Sync for NodeConstructor<'a>

§

impl<'a> Unpin for NodeConstructor<'a>

§

impl<'a> !UnwindSafe for NodeConstructor<'a>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.