Skip to main content

Node

Struct Node 

Source
pub struct Node {
Show 24 fields pub id: NodeId, pub kind: Kind, pub name: String, pub x: f32, pub y: f32, pub width: Size, pub height: Size, pub opacity: f32, pub on_click: Option<String>, pub fill: Option<Fill>, pub stroke: Option<Color>, pub stroke_width: f32, pub radius: [f32; 4], pub shadow: Option<Shadow>, pub clip: bool, pub layout: Layout, pub gap: f32, pub padding: [f32; 4], pub align: Align, pub justify: Align, pub text: Option<TextStyle>, pub vector: Option<Vector>, pub image: Option<Image>, pub children: Children<Node>,
}
Expand description

One node of a scene.

Fields§

§id: NodeId

Where the node came from — see NodeId — which no edit around it changes.

§kind: Kind

What the node is.

§name: String

The node’s name: its name attribute, or else its element’s, as problems call it.

§x: f32

How far right of its parent’s top-left the node sits, in pixels; only a parent with no auto layout places it by this.

§y: f32

How far down from its parent’s top-left the node sits, in pixels; only a parent with no auto layout places it by this.

§width: Size

How the node’s width is set.

§height: Size

How the node’s height is set.

§opacity: f32

How opaque the node and everything in it is, from 0 to 1.

§on_click: Option<String>

What a click on the node does: navigate <path>, back, overlay <path> or close, each path from the top of the served folder. None when a click does nothing.

§fill: Option<Fill>

What the node’s box is filled with; None for nothing.

§stroke: Option<Color>

The color of the node’s outline; None for no outline.

§stroke_width: f32

How wide the outline is, in pixels.

§radius: [f32; 4]

Each corner’s radius, in pixels: top-left, top-right, bottom-right, bottom-left.

§shadow: Option<Shadow>

The node’s drop shadow; None for none.

§clip: bool

Whether a frame’s children are cut off at its box, rounded corners and all.

§layout: Layout

How a frame places its children.

§gap: f32

The space between a frame’s children in its auto layout, in pixels.

§padding: [f32; 4]

The space inside a frame’s edges, in pixels: top, right, bottom, left.

§align: Align

Where a frame’s auto layout puts its children across its direction.

§justify: Align

Where a frame’s auto layout puts its children along its direction.

§text: Option<TextStyle>

A Text’s text and how it is set; None for any other kind.

§vector: Option<Vector>

A Vector’s path; None for any other kind.

§image: Option<Image>

An Image’s file; None for any other kind.

§children: Children<Node>

The node’s children, in order.

Implementations§

Source§

impl Node

Source

pub fn same_own(&self, b: &Node) -> bool

Whether two nodes’ own attributes are the same, their children aside.

Source

pub fn own(&self) -> Node

The node’s own attributes, without its children.

Trait Implementations§

Source§

impl Clone for Node

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 Debug for Node

Source§

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

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

impl PartialEq for Node

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 StructuralPartialEq for Node

Auto Trait Implementations§

§

impl Forget for Node

§

impl Freeze for Node
where *const u8 is !null: Freeze, PhantomData<u32>: Freeze, PhantomData<u8>: Freeze, PhantomData<(Color, f32)>: Freeze, *const LeafNode<OrderKey, Node> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(OrderKey, Node)>>: Freeze,

§

impl Move for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node
where RawVecInner: Send, NodeRef<Owned, OrderKey, Node, LeafOrInternal>: Send, BoxRaw<(OrderKey, Node)>: Send,

§

impl Sync for Node
where RawVecInner: Sync, NodeRef<Owned, OrderKey, Node, LeafOrInternal>: Sync, BoxRaw<(OrderKey, Node)>: Sync,

§

impl Unpin for Node
where *const u8 is !null: Unpin, *const LeafNode<OrderKey, Node> is !null: Unpin, Box<(OrderKey, Node)>: Unpin,

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node
where RawVecInner: UnwindSafe, BTreeMap<OrderKey, Node>: 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> ErasedDestructor for T
where T: 'static,

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

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.