pub struct UiNode { /* private fields */ }Expand description
A stable declarative UI node. Script-produced nodes contain no GPUI values or lifetimes; trusted Rust Hosts may attach opaque foreground callbacks.
Implementations§
Source§impl UiNode
impl UiNode
pub fn text(text: impl Into<ImmutableString>) -> Self
pub fn rich_text(spans: Vec<Span>) -> Self
pub fn canvas(scene: CanvasScene) -> Self
Sourcepub fn svg(source: impl Into<String>) -> Result<Self, InlineSvgError>
pub fn svg(source: impl Into<String>) -> Result<Self, InlineSvgError>
Construct a validated self-contained inline SVG atom.
§Errors
Returns crate::InlineSvgError for active, external, or oversized
markup.
pub fn box_node(children: Vec<Self>) -> Self
pub fn fragment(children: Vec<Self>) -> Self
pub fn column(children: Vec<Self>) -> Self
pub fn row(children: Vec<Self>) -> Self
pub fn custom(primitive: PrimitiveNode) -> Self
pub fn error_boundary(child: Self, fallback: Self) -> Self
pub fn image(handle: OpaqueHandle) -> Self
pub fn asset_image(asset: AssetId) -> Self
pub fn directional_image( left_to_right: OpaqueHandle, right_to_left: OpaqueHandle, ) -> Self
pub fn directional_asset_image( left_to_right: AssetId, right_to_left: AssetId, ) -> Self
pub fn overlay(trigger: Self, content: Self, spec: OverlayNodeSpec) -> Self
pub fn layer(content: Self, spec: LayerNodeSpec) -> Self
pub fn virtual_collection(spec: VirtualCollectionNodeSpec) -> Self
pub fn with_key(self, key: impl Into<ImmutableString>) -> Self
pub fn with_style(self, style: &Style) -> Self
Sourcepub fn with_signal_binding(
self,
property: SignalProperty,
signal: NativeSignal,
) -> Result<Self, SignalError>
pub fn with_signal_binding( self, property: SignalProperty, signal: NativeSignal, ) -> Result<Self, SignalError>
Bind one approved hot property to a component-scoped native signal.
§Errors
Returns a property/type mismatch without changing the node.
pub fn with_element_ref(self, reference: ElementRef) -> Self
pub fn with_scrollbars(self, spec: ScrollbarSpec) -> Self
pub fn with_part_styles(self, styles: BTreeMap<String, Style>) -> Self
pub fn with_part_style(self, part: impl Into<String>, style: Style) -> Self
pub fn with_source(self, source: SourceLocation) -> Self
pub fn component_root(&self) -> Option<&ComponentInstancePath>
pub fn with_attribute(self, name: impl Into<String>, value: UiValue) -> Self
pub fn with_handler( self, event: impl Into<String>, handler: impl Into<UiEventHandler>, ) -> Self
pub fn with_handler_phase( self, event: impl Into<String>, phase: EventPhase, handler: impl Into<UiEventHandler>, ) -> Self
pub fn with_host_handler( self, event: impl Into<String>, callback: HostCallback, ) -> Self
pub fn with_handler_payload( self, event: impl Into<String>, payload: UiValue, ) -> Self
pub fn with_motion(self, animation: MotionSource) -> Self
pub fn with_exit_motion(self, motion: MotionSource) -> Self
pub fn with_progress_motion(self, binding: MotionProgressBinding) -> Self
pub fn with_motion_replay_key(self, key: impl Into<String>) -> Self
pub fn with_motion_particle_count(self, count: usize) -> Self
pub fn with_timeline(self, timeline: MotionTimeline) -> Self
Sourcepub fn with_layout_motion(self, duration_ms: u64, easing: MotionEasing) -> Self
pub fn with_layout_motion(self, duration_ms: u64, easing: MotionEasing) -> Self
Opt this node into committed-geometry layout motion.
Assign a same-window shared-layout identity to this real node.
pub fn handlers(&self) -> &BTreeMap<String, Vec<UiEventBinding>>
pub fn handler(&self, event: &str) -> Option<&UiEventHandler>
pub fn event_handlers(&self, event: &str) -> &[UiEventBinding]
pub fn handler_payload(&self, event: &str) -> Option<&UiValue>
pub fn motions(&self) -> &[MotionSource]
pub fn exit_motions(&self) -> &[MotionSource]
pub fn progress_motions(&self) -> &[MotionProgressBinding]
pub fn timelines(&self) -> &[MotionTimeline]
pub fn kind(&self) -> &UiNodeKind
pub const fn kind_tag(&self) -> UiNodeKindTag
pub fn key(&self) -> Option<&NodeKey>
pub fn style(&self) -> &Style
pub fn part_style(&self, part: &str) -> Option<&Style>
pub fn part_styles(&self) -> impl Iterator<Item = (&str, &Style)>
pub fn source(&self) -> Option<&SourceLocation>
pub fn attributes(&self) -> &BTreeMap<String, UiValue>
pub fn signal_bindings( &self, ) -> impl ExactSizeIterator<Item = (SignalProperty, &NativeSignal)>
pub const fn element_ref(&self) -> Option<&ElementRef>
Trait Implementations§
Source§impl CustomType for UiNode
impl CustomType for UiNode
impl StructuralPartialEq for UiNode
Auto Trait Implementations§
impl !RefUnwindSafe for UiNode
impl !Send for UiNode
impl !Sync for UiNode
impl !UnwindSafe for UiNode
impl Freeze for UiNode
impl Unpin for UiNode
impl UnsafeUnpin for UiNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Variant for T
impl<T> Variant for T
Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert this
Variant trait object to &mut dyn Any.Source§fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
fn as_boxed_any(self: Box<T>) -> Box<dyn Any>
Convert this
Variant trait object to Box<dyn Any>.