Skip to main content

Node

Struct Node 

Source
#[non_exhaustive]
pub struct Node { pub element: Element, pub style: Option<String>, pub if: Option<String>, pub unless: Option<String>, pub if_stale: Option<bool>, pub if_fullscreen: Option<bool>, pub accessibility: Option<Accessibility>, pub transition: Option<Transition>, pub privacy: Option<Privacy>, }
Expand description

One node of a layout tree: an element and the members every node may carry.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§element: Element§style: Option<String>

A token of the request’s style table.

§if: Option<String>

Key of a value; the node is rendered only while it is truthy.

§unless: Option<String>

Key of a value; the node is rendered only while it is not truthy.

§if_stale: Option<bool>

true: the node is rendered only while the content is stale; false: only while it is not.

§if_fullscreen: Option<bool>

true: the node is rendered only while the Lock Screen presentation fills the screen, in StandBy; false: only while it does not.

§accessibility: Option<Accessibility>

What assistive technologies read of the node.

§transition: Option<Transition>

How the node comes and goes when if or unless shows or hides it.

§privacy: Option<Privacy>

Whether the system hides what the node shows on a locked device.

Implementations§

Source§

impl Node

Modifiers. Each one that belongs to certain nodes says which, and leaves every other node as it is.

Source

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

Draws the node with the style token of the layout’s style table.

Source

pub fn when(self, key: impl Into<String>) -> Node

Draws the node only while the value key is truthy: true, a number other than 0 or non-empty text. The wire member is if. A node takes when or unless, not both.

Source

pub fn unless(self, key: impl Into<String>) -> Node

Draws the node only while the value key is not truthy.

Source

pub fn when_stale(self) -> Node

Draws the node only while the content is stale: its stale date (Start::stale_at, Update::stale_at) has passed and no update has come since. The system says so when it draws the activity, so the node appears without the app running. The wire member is ifStale; beside when or unless the node is drawn while both hold.

Source

pub fn unless_stale(self) -> Node

Draws the node only while the content is not stale: see when_stale.

Source

pub fn when_fullscreen(self) -> Node

Draws the node only while the Lock Screen presentation fills the screen: in StandBy, where an iPhone that charges on its side shows it scaled up, with room for more. The system says so when it draws the activity. The wire member is ifFullscreen; beside the other conditions the node is drawn while all hold. The island’s parts and the small family are never full screen.

Source

pub fn unless_fullscreen(self) -> Node

Draws the node only while the Lock Screen presentation does not fill the screen: see when_fullscreen.

Source

pub fn accessibility(self, accessibility: Accessibility) -> Node

What assistive technologies read of the node: see Accessibility.

Source

pub fn transition(self, transition: Transition) -> Node

How the node comes and goes while when or unless shows or hides it.

Source

pub fn sensitive(self) -> Node

Marks what the node shows as private: see Privacy::Sensitive.

Source

pub fn spacing(self, points: f64) -> Node

Space between the children of a vstack or an hstack, 0 to 64 points.

Source

pub fn alignment(self, alignment: impl StackAlignment) -> Node

The alignment of a stack’s children; see StackAlignment.

Source

pub fn min_length(self, points: f64) -> Node

The least length of a spacer, 0 to 256 points.

Source

pub fn rendering(self, mode: SymbolRendering) -> Node

How a symbol is colored.

Source

pub fn variable(self, key: impl Into<String>) -> Node

The variable value of a symbol: the number value key, 0 to 1.

Source

pub fn resizable(self) -> Node

Lets an image scale to its frame.

Source

pub fn content_mode(self, mode: ContentMode) -> Node

How a resizable image fills its frame.

Source

pub fn stroke(self, width: f64) -> Node

Strokes a path with this line width, 0.5 to 16 points, instead of filling it.

Source

pub fn kind(self, shape: IndicatorKind) -> Node

The shape of a progress or a gauge.

Source

pub fn range(self, low: f64, high: f64) -> Node

The range of a gauge; min must be below max.

Source

pub fn counts_up(self) -> Node

Makes a timer count up from its start.

Source

pub fn prop( self, key: impl Into<String>, value: impl Into<Bindable<Value>>, ) -> Node

A prop of a custom node: a literal, or Bound to a value of any type. 1 to 16 props.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

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<(), Error>

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

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

Source§

fn deserialize<D>( deserializer: D, ) -> Result<Node, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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

impl From<Element> for Node

Source§

fn from(element: Element) -> Node

Converts to this type from the input type.
Source§

impl PartialEq for Node

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Node

Source§

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

Serialize this value into the given Serde serializer. 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<Node>: Freeze, PhantomData<u8>: Freeze, *const Node is !null: Freeze, *const LeafNode<String, Bindable<Value>> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, Bindable<Value>)>>: Freeze,

§

impl Move for Node

§

impl RefUnwindSafe for Node

§

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

§

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

§

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

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node
where RawVecInner: UnwindSafe, BoxRaw<Node>: UnwindSafe, BTreeMap<String, Bindable<Value>>: 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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