Struct Node

Source
pub struct Node {
    pub attr: Attribute,
    pub class: Vec<Class>,
    pub style: Vec<Style>,
    pub children: Vec<Rc<RefCell<Node>>>,
    pub pre: Option<Weak<RefCell<Node>>>,
    pub state: Option<StateKV>,
    pub gesture: Option<GestureKV>,
}
Expand description

Virtual UI Node

Fields§

§attr: Attribute

Node attribute

§class: Vec<Class>

Node Class

§style: Vec<Style>

Node Class

§children: Vec<Rc<RefCell<Node>>>

Node children

§pre: Option<Weak<RefCell<Node>>>

Node parent

§state: Option<StateKV>

Node state

§gesture: Option<GestureKV>

Node Gestures

Implementations§

Source§

impl Node

Source

pub fn attr(self, attr: Attribute) -> Node

Set attribute

Source

pub fn children(self, children: Vec<Node>) -> Node

Set Children

Source

pub fn append_child(self, child: Node) -> Node

append child

Source

pub fn append_children(self, children: Vec<Node>) -> Node

append children

Source

pub fn class(self, class: Vec<Class>) -> Node

Set class

Source

pub fn append_class(self, class: &mut Vec<Class>) -> Node

Append class

Source

pub fn style(self, style: impl Into<Vec<Style>>) -> Node

Set style

Source

pub fn append_style(self, styles: impl Into<Vec<Style>>) -> Node

Append style

Source

pub fn drain(t: Rc<RefCell<Node>>)

Drain tree if not the root

Source

pub fn idx(&mut self, path: &mut Vec<u8>)

The path of current node

Source

pub fn locate(&self, path: Vec<usize>) -> Vec<usize>

Locate tree

Source

pub fn push(r: Rc<RefCell<Node>>, c: Rc<RefCell<Node>>)

Add second tree to the first one.

Source

pub fn remove(&mut self, c: Rc<RefCell<Node>>)

Delete spefic child using rc

Source

pub fn replace(&mut self, t: Node)

Replace current tree

Source

pub fn update(&mut self)

Update tree

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

Returns a copy of the value. Read more
1.0.0 · 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 Default for Node

Source§

fn default() -> Node

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

impl<W> Into<Node> for GestureDetector<W>
where W: Into<Node>,

Source§

fn into(self) -> Node

Converts this type into the (usually inferred) input type.
Source§

impl<W> Into<Node> for State<W>
where W: Into<Node>,

Source§

fn into(self) -> Node

Converts this type into the (usually inferred) input type.
Source§

impl PartialEq for Node

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StyleWrapper for Node

Source§

fn wrap(self) -> Node

Converet widget to node
Source§

impl Eq for Node

Auto Trait Implementations§

§

impl Freeze for Node

§

impl !RefUnwindSafe for Node

§

impl !Send for Node

§

impl !Sync for Node

§

impl Unpin for Node

§

impl !UnwindSafe for Node

Blanket Implementations§

Source§

impl<T> AlignItems for T
where T: Into<Node>,

Source§

fn align_items(self, value: FlexPosition) -> Node

AlignItem Style
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> BackgroundColor for T
where T: Into<Node>,

Source§

fn background_color(self, value: Color) -> Node

Custom Color
Source§

impl<T> Border for T
where T: Into<Node>,

Source§

fn border(self, value: BoxBorder) -> Node

Border Border
Source§

impl<T> BorderBottom for T
where T: Into<Node>,

Source§

fn border_bottom(self, value: BoxBorder) -> Node

Border Bottom
Source§

impl<T> BorderLeft for T
where T: Into<Node>,

Source§

fn border_left(self, value: BoxBorder) -> Node

Border Left
Source§

impl<T> BorderRight for T
where T: Into<Node>,

Source§

fn border_right(self, value: BoxBorder) -> Node

Border Right
Source§

impl<T> BorderTop for T
where T: Into<Node>,

Source§

fn border_top(self, value: BoxBorder) -> Node

Border Top
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> Bottom for T
where T: Into<Node>,

Source§

fn bottom(self, value: Unit) -> Node

Box Bottom
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> Color for T
where T: Into<Node>,

Source§

fn color(self, value: Color) -> Node

Custom Color
Source§

impl<T> ColumnCount for T
where T: Into<Node>,

Source§

fn column_count(self, value: Unit) -> Node

ColumnCount Style
Source§

impl<T> ColumnGap for T
where T: Into<Node>,

Source§

fn column_gap(self, value: Unit) -> Node

ColumnGap Style
Source§

impl<T> ColumnRuleColor for T
where T: Into<Node>,

Source§

fn column_rule_color(self, value: Color) -> Node

ColumnRuleColor Style
Source§

impl<T> ColumnRuleStyle for T
where T: Into<Node>,

Source§

fn column_rule_style(self, value: MultiColumnLineStyle) -> Node

ColumnRuleStyle Style
Source§

impl<T> FlexGrow for T
where T: Into<Node>,

Source§

fn flex_glow(self, value: Unit) -> Node

FlexGrow Style
Source§

impl<T> FontSize for T
where T: Into<Node>,

Source§

fn font_size(self, value: Unit) -> Node

Font Size Style
Source§

impl<T> FontStretch for T
where T: Into<Node>,

Source§

fn font_stretch(self, value: Unit) -> Node

Font Stretch Style
Source§

impl<T> FontWeight for T
where T: Into<Node>,

Source§

fn font_weight(self, value: Unit) -> Node

Font Weight Style
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GridAutoColumns for T
where T: Into<Node>,

Source§

fn grid_auto_columns(self, value: GridAuto) -> Node

GridAutoColumn Style
Source§

impl<T> GridAutoFlow for T
where T: Into<Node>,

Source§

fn grid_auto_flow(self, value: GridFlow) -> Node

GridAutoFlow Style
Source§

impl<T> GridAutoRows for T
where T: Into<Node>,

Source§

fn grid_auto_rows(self, value: GridAuto) -> Node

GridAutoColumn Style
Source§

impl<T> GridColumnGap for T
where T: Into<Node>,

Source§

fn grid_column_gap(self, value: Unit) -> Node

GridColumnGap Style
Source§

impl<T> GridRowGap for T
where T: Into<Node>,

Source§

fn grid_row_rap(self, value: Unit) -> Node

GridColumnGap Style
Source§

impl<T> GridTemplateColumns for T
where T: Into<Node>,

Source§

fn grid_template_columns(self, value: GridTemplate) -> Node

GridTemplateColumns Style
Source§

impl<T> GridTemplateRows for T
where T: Into<Node>,

Source§

fn grid_tempalte_row(self, value: GridTemplate) -> Node

GridTemplateRow Style
Source§

impl<T> Height for T
where T: Into<Node>,

Source§

fn height(self, value: Unit) -> Node

Box Height
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> JustifyContent for T
where T: Into<Node>,

Source§

fn justify_content(self, value: FlexPosition) -> Node

AlignItem Style
Source§

impl<T> Left for T
where T: Into<Node>,

Source§

fn left(self, value: Unit) -> Node

Box Left
Source§

impl<T> LineHeight for T
where T: Into<Node>,

Source§

fn line_hegiht(self, value: Unit) -> Node

Line Height Style
Source§

impl<T> Margin for T
where T: Into<Node>,

Source§

fn margin(self, value: VecUnit) -> Node

Box Margin
Source§

impl<T> MarginBottom for T
where T: Into<Node>,

Source§

fn margin_bottom(self, value: Unit) -> Node

Margin Bottom
Source§

impl<T> MarginLeft for T
where T: Into<Node>,

Source§

fn margin_left(self, value: Unit) -> Node

Margin left
Source§

impl<T> MarginRight for T
where T: Into<Node>,

Source§

fn margin_right(self, value: Unit) -> Node

Margin right
Source§

impl<T> MarginTop for T
where T: Into<Node>,

Source§

fn margin_top(self, value: Unit) -> Node

Margin Top
Source§

impl<T> MaxHeight for T
where T: Into<Node>,

Source§

fn max_height(self, value: Unit) -> Node

Box Max Height
Source§

impl<T> MaxWidth for T
where T: Into<Node>,

Source§

fn max_width(self, value: Unit) -> Node

Box Max Width
Source§

impl<T> Order for T
where T: Into<Node>,

Source§

fn order(self, value: Unit) -> Node

FlexOrder Style
Source§

impl<T> OutlineWidth for T
where T: Into<Node>,

Source§

fn outline_width(self, value: Unit) -> Node

Box Outline Width
Source§

impl<T> Padding for T
where T: Into<Node>,

Source§

fn padding(self, value: VecUnit) -> Node

Box Padding
Source§

impl<T> PaddingBottom for T
where T: Into<Node>,

Source§

fn padding_bottom(self, value: Unit) -> Node

Padding Bottom
Source§

impl<T> PaddingLeft for T
where T: Into<Node>,

Source§

fn padding_left(self, value: Unit) -> Node

Padding left
Source§

impl<T> PaddingRight for T
where T: Into<Node>,

Source§

fn padding_right(self, value: Unit) -> Node

Padding right
Source§

impl<T> PaddingTop for T
where T: Into<Node>,

Source§

fn padding_top(self, value: Unit) -> Node

Padding Top
Source§

impl<T> Right for T
where T: Into<Node>,

Source§

fn right(self, value: Unit) -> Node

Box Right
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> Top for T
where T: Into<Node>,

Source§

fn top(self, value: Unit) -> Node

Box Top
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.
Source§

impl<T> Width for T
where T: Into<Node>,

Source§

fn width(self, value: Unit) -> Node

Box Width