Node

Struct Node 

Source
pub struct Node {
Show 37 fields pub id: String, pub name: String, pub visible: Option<bool>, pub type: NodeType, pub children: Option<Vec<Node>>, pub background_color: Option<Color>, pub fills: Option<Vec<Paint>>, pub strokes: Option<Vec<Paint>>, pub stroke_weight: Option<f64>, pub individual_stroke_weights: Option<StrokeWeights>, pub stroke_align: Option<StrokeAlign>, pub stroke_dashes: Option<Vec<f64>>, pub corner_radius: Option<f64>, pub rectangle_corner_radii: Option<[f64; 4]>, pub transition_duration: Option<f64>, pub transition_easing: Option<EasingType>, pub opacity: Option<f64>, pub absolute_bounding_box: Option<Rectangle>, pub absolute_render_bounds: Option<Rectangle>, pub primary_axis_sizing_mode: Option<AxisSizingMode>, pub counter_axis_sizing_mode: Option<AxisSizingMode>, pub primary_axis_align_items: Option<PrimaryAxisAlignItems>, pub counter_axis_align_items: Option<CounterAxisAlignItems>, pub item_spacing: Option<f64>, pub layout_positioning: Option<LayoutPositioning>, pub layout_mode: Option<LayoutMode>, pub padding_left: Option<f64>, pub padding_right: Option<f64>, pub padding_top: Option<f64>, pub padding_bottom: Option<f64>, pub effects: Option<Vec<Effect>>, pub styles: Option<Styles>, pub characters: Option<String>, pub style: Option<TypeStyle>, pub constraints: Option<LayoutConstraint>, pub layout_align: Option<LayoutAlign>, pub layout_grow: Option<f64>,
}
Expand description

Fields§

§id: String

A string uniquely identifying this node within the document.

§name: String

The name given to the node by the user in the tool.

§visible: Option<bool>

Whether or not the node is visible on the canvas.

§type: NodeType

The type of the node

§children: Option<Vec<Node>>

An array of nodes that are direct children of this node

§background_color: Option<Color>

Background color of the canvas

§fills: Option<Vec<Paint>>

An array of fill paints applied to the node

§strokes: Option<Vec<Paint>>

An array of stroke paints applied to the node

§stroke_weight: Option<f64>

The weight of strokes on the node

§individual_stroke_weights: Option<StrokeWeights>

An object including the top, bottom, left, and right stroke weights. Only returned if individual stroke weights are used.

§stroke_align: Option<StrokeAlign>

Position of stroke relative to vector outline

§stroke_dashes: Option<Vec<f64>>

An array of floating point numbers describing the pattern of dash length and gap lengths that the vector path follows. For example a value of [1, 2] indicates that the path has a dash of length 1 followed by a gap of length 2, repeated.

§corner_radius: Option<f64>

Radius of each corner of the node if a single radius is set for all corners

§rectangle_corner_radii: Option<[f64; 4]>

Array of length 4 of the radius of each corner of the node, starting in the top left and proceeding clockwise

§transition_duration: Option<f64>

The duration of the prototyping transition on this node (in milliseconds)

§transition_easing: Option<EasingType>

The easing curve used in the prototyping transition on this node

§opacity: Option<f64>

Opacity of the node

§absolute_bounding_box: Option<Rectangle>

Bounding box of the node in absolute space coordinates

§absolute_render_bounds: Option<Rectangle>

The bounds of the rendered node in the file in absolute space coordinates

§primary_axis_sizing_mode: Option<AxisSizingMode>

Whether the primary axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames.

§counter_axis_sizing_mode: Option<AxisSizingMode>

Whether the counter axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames.

§primary_axis_align_items: Option<PrimaryAxisAlignItems>

Determines how the auto-layout frame’s children should be aligned in the primary axis direction. This property is only applicable for auto-layout frames.

§counter_axis_align_items: Option<CounterAxisAlignItems>

Determines how the auto-layout frame’s children should be aligned in the counter axis direction. This property is only applicable for auto-layout frames.

§item_spacing: Option<f64>

The distance between children of the frame. Can be negative. This property is only applicable for auto-layout frames.

§layout_positioning: Option<LayoutPositioning>

Determines whether a layer’s size and position should be determined by auto-layout settings or manually adjustable.

§layout_mode: Option<LayoutMode>

Whether this layer uses auto-layout to position its children.

§padding_left: Option<f64>

The padding between the left border of the frame and its children. This property is only applicable for auto-layout frames.

§padding_right: Option<f64>

The padding between the right border of the frame and its children. This property is only applicable for auto-layout frames.

§padding_top: Option<f64>

The padding between the top border of the frame and its children. This property is only applicable for auto-layout frames.

§padding_bottom: Option<f64>

The padding between the bottom border of the frame and its children. This property is only applicable for auto-layout frames.

§effects: Option<Vec<Effect>>

An array of effects attached to this node

§styles: Option<Styles>

A mapping of a StyleType to style ID of styles present on this node. The style ID can be used to look up more information about the style in the top-level styles field.

§characters: Option<String>

Text contained within a text box

§style: Option<TypeStyle>

Style of text including font family and weight

§constraints: Option<LayoutConstraint>

Horizontal and vertical layout contraints for node

§layout_align: Option<LayoutAlign>

Determines if the layer should stretch along the parent’s counter axis. This property is only provided for direct children of auto-layout frames.

§layout_grow: Option<f64>

This property is applicable only for direct children of auto-layout frames, ignored otherwise. Determines whether a layer should stretch along the parent’s primary axis. A 0 corresponds to a fixed size and 1 corresponds to stretch

Implementations§

Source§

impl Node

Source

pub fn visible(&self) -> bool

Source

pub fn background_color(&self) -> Option<&Color>

Source

pub fn absolute_bounding_box(&self) -> Option<&Rectangle>

Source

pub fn corner_radius(&self) -> Option<f64>

Source

pub fn rectangle_corner_radii(&self) -> Option<[f64; 4]>

Source

pub fn transition_duration(&self) -> Option<f64>

Source

pub fn transition_easing(&self) -> Option<&EasingType>

Source

pub fn opacity(&self) -> f64

Source

pub fn padding_left(&self) -> f64

Source

pub fn padding_right(&self) -> f64

Source

pub fn padding_top(&self) -> f64

Source

pub fn padding_bottom(&self) -> f64

Source

pub fn children(&self) -> &[Node]

Source

pub fn enabled_children(&self) -> impl Iterator<Item = &Node>

Source

pub fn fills(&self) -> &[Paint]

Source

pub fn strokes(&self) -> &[Paint]

Source

pub fn depth_first_stack_iter(&self) -> NodeDepthFirstStackIterator<'_>

Source

pub fn component<'a>(&self, file: &'a File) -> Option<&'a Component>

Source

pub fn stroke_weight(&self) -> Option<f64>

Source

pub fn stroke_align(&self) -> Option<&StrokeAlign>

Trait Implementations§

Source§

impl Debug for Node

Source§

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

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

impl<'de> Deserialize<'de> for Node

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Node

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,