Skip to main content

BoundStateful

Struct BoundStateful 

Source
pub struct BoundStateful<S>{ /* private fields */ }
Expand description

A bound stateful element that maintains shared storage with an ElementRef

This wrapper is returned by Stateful::bind() and provides the same fluent API as Stateful, but all modifications go through shared storage accessible via the original ElementRef.

Implementations§

Source§

impl<S> BoundStateful<S>

Source

pub fn on_state<F>(self, callback: F) -> BoundStateful<S>
where F: Fn(&S, &mut Div) + Send + Sync + 'static,

Set the state callback (builder pattern)

Source

pub fn w(self, px: f32) -> BoundStateful<S>

Set width (builder pattern)

Source

pub fn h(self, px: f32) -> BoundStateful<S>

Set height (builder pattern)

Source

pub fn w_full(self) -> BoundStateful<S>

Set width to 100% (builder pattern)

Source

pub fn h_full(self) -> BoundStateful<S>

Set height to 100% (builder pattern)

Source

pub fn size(self, w: f32, h: f32) -> BoundStateful<S>

Set both width and height (builder pattern)

Source

pub fn square(self, size: f32) -> BoundStateful<S>

Set square size (builder pattern)

Source

pub fn flex_row(self) -> BoundStateful<S>

Set flex direction to row (builder pattern)

Source

pub fn flex_col(self) -> BoundStateful<S>

Set flex direction to column (builder pattern)

Source

pub fn flex_grow(self) -> BoundStateful<S>

Set flex grow (builder pattern)

Source

pub fn w_fit(self) -> BoundStateful<S>

Set width to fit content (builder pattern)

Source

pub fn h_fit(self) -> BoundStateful<S>

Set height to fit content (builder pattern)

Source

pub fn p(self, units: f32) -> BoundStateful<S>

Set padding all sides (builder pattern)

Source

pub fn px(self, units: f32) -> BoundStateful<S>

Set horizontal padding (builder pattern)

Source

pub fn py(self, units: f32) -> BoundStateful<S>

Set vertical padding (builder pattern)

Source

pub fn gap(self, units: f32) -> BoundStateful<S>

Set gap (builder pattern)

Source

pub fn items_center(self) -> BoundStateful<S>

Center items (builder pattern)

Source

pub fn justify_center(self) -> BoundStateful<S>

Center justify (builder pattern)

Source

pub fn justify_between(self) -> BoundStateful<S>

Space between (builder pattern)

Source

pub fn bg(self, color: impl Into<Brush>) -> BoundStateful<S>

Set background (builder pattern)

Source

pub fn rounded(self, radius: f32) -> BoundStateful<S>

Set corner radius (builder pattern)

Source

pub fn border(self, width: f32, color: Color) -> BoundStateful<S>

Set border with color and width (builder pattern)

Source

pub fn border_color(self, color: Color) -> BoundStateful<S>

Set border color only (builder pattern)

Source

pub fn border_width(self, width: f32) -> BoundStateful<S>

Set border width only (builder pattern)

Source

pub fn shadow(self, shadow: Shadow) -> BoundStateful<S>

Set shadow (builder pattern)

Source

pub fn shadow_sm(self) -> BoundStateful<S>

Set small shadow (builder pattern)

Source

pub fn shadow_md(self) -> BoundStateful<S>

Set medium shadow (builder pattern)

Source

pub fn shadow_lg(self) -> BoundStateful<S>

Set large shadow (builder pattern)

Source

pub fn shadow_xl(self) -> BoundStateful<S>

Set extra-large shadow (builder pattern)

Source

pub fn opacity(self, opacity: f32) -> BoundStateful<S>

Set opacity (builder pattern)

Source

pub fn flex_shrink(self) -> BoundStateful<S>

Set flex shrink (builder pattern)

Source

pub fn flex_shrink_0(self) -> BoundStateful<S>

Set flex shrink to 0 (builder pattern)

Source

pub fn transform_style(self, xform: Transform) -> BoundStateful<S>

Set transform (builder pattern)

Source

pub fn overflow_clip(self) -> BoundStateful<S>

Set overflow to clip (clips children to container bounds)

Source

pub fn cursor(self, cursor: CursorStyle) -> BoundStateful<S>

Set cursor style (builder pattern)

Source

pub fn cursor_pointer(self) -> BoundStateful<S>

Set cursor to pointer (hand) - convenience for clickable elements

Source

pub fn cursor_text(self) -> BoundStateful<S>

Set cursor to text (I-beam) - for text input areas

Source

pub fn child(self, child: impl ElementBuilder + 'static) -> BoundStateful<S>

Add child (builder pattern)

Source

pub fn on_click<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a click handler (builder pattern)

Source

pub fn on_mouse_down<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a mouse down handler (builder pattern)

Source

pub fn on_mouse_up<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a mouse up handler (builder pattern)

Source

pub fn on_hover_enter<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a hover enter handler (builder pattern)

Source

pub fn on_hover_leave<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a hover leave handler (builder pattern)

Source

pub fn on_focus<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a focus handler (builder pattern)

Source

pub fn on_blur<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a blur handler (builder pattern)

Source

pub fn on_mount<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a mount handler (builder pattern)

Source

pub fn on_unmount<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register an unmount handler (builder pattern)

Source

pub fn on_key_down<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a key down handler (builder pattern)

Source

pub fn on_key_up<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a key up handler (builder pattern)

Source

pub fn on_scroll<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a scroll handler (builder pattern)

Source

pub fn on_mouse_move<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a mouse move handler (builder pattern)

Source

pub fn on_resize<F>(self, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a resize handler (builder pattern)

Source

pub fn on_event<F>(self, event_type: u32, handler: F) -> BoundStateful<S>
where F: Fn(&EventContext) + Send + Sync + 'static,

Register a handler for a specific event type (builder pattern)

Source

pub fn on_layout<F>(self, callback: F) -> BoundStateful<S>
where F: Fn(ElementBounds) + Send + Sync + 'static,

Set a layout callback that fires synchronously after each layout computation (builder pattern)

Trait Implementations§

Source§

impl<S> ElementBuilder for BoundStateful<S>

Source§

fn build(&self, tree: &mut LayoutTree) -> LayoutNodeId

Build this element into a layout tree, returning the node ID
Source§

fn render_props(&self) -> RenderProps

Get the render properties for this element
Source§

fn children_builders(&self) -> &[Box<dyn ElementBuilder>]

Get children builders (for recursive traversal)
Source§

fn element_type_id(&self) -> ElementTypeId

Get the element type identifier
Source§

fn layout_animation_config(&self) -> Option<LayoutAnimationConfig>

Get layout animation configuration for this element Read more
Source§

fn visual_animation_config(&self) -> Option<VisualAnimationConfig>

Get visual animation config for new FLIP-style animations (read-only layout) Read more
Source§

fn text_render_info(&self) -> Option<TextRenderInfo>

Get text render info if this is a text element
Source§

fn styled_text_render_info(&self) -> Option<StyledTextRenderInfo>

Get styled text render info if this is a styled text element (rich_text)
Source§

fn svg_render_info(&self) -> Option<SvgRenderInfo>

Get SVG render info if this is an SVG element
Source§

fn image_render_info(&self) -> Option<ImageRenderInfo>

Get image render info if this is an image element
Source§

fn canvas_render_info( &self, ) -> Option<Rc<dyn Fn(&mut dyn DrawContext, CanvasBounds)>>

Get canvas render info if this is a canvas element
Source§

fn event_handlers(&self) -> Option<&EventHandlers>

Get event handlers for this element Read more
Source§

fn scroll_info(&self) -> Option<ScrollRenderInfo>

Get scroll render info if this is a scroll element
Source§

fn scroll_physics(&self) -> Option<Arc<Mutex<ScrollPhysics>>>

Get scroll physics handle if this is a scroll element
Source§

fn motion_animation_for_child( &self, _child_index: usize, ) -> Option<MotionAnimation>

Get motion animation config for a child at given index Read more
Source§

fn motion_bindings(&self) -> Option<MotionBindings>

Get motion bindings for continuous animation Read more
Source§

fn motion_stable_id(&self) -> Option<&str>

Get stable ID for motion animation tracking Read more
Source§

fn motion_should_replay(&self) -> bool

Check if this motion should replay its animation Read more
Source§

fn motion_is_suspended(&self) -> bool

Check if this motion should start in suspended state Read more
Source§

fn motion_is_exiting(&self) -> bool

👎Deprecated since 0.1.0:

Use query_motion(key).exit() to explicitly trigger motion exit

DEPRECATED: Check if this motion should start its exit animation Read more
Source§

fn layout_style(&self) -> Option<&Style>

Get the layout style for this element Read more
Source§

fn layout_bounds_storage(&self) -> Option<Arc<Mutex<Option<ElementBounds>>>>

Get layout bounds storage for this element Read more
Source§

fn layout_bounds_callback( &self, ) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>

Get layout bounds change callback for this element Read more
Source§

fn semantic_type_name(&self) -> Option<&'static str>

Semantic HTML-like tag name for CSS type selectors (e.g., “button”, “a”, “ul”) Read more
Source§

fn element_id(&self) -> Option<&str>

Get the element ID for selector API queries Read more
Source§

fn set_auto_id(&mut self, _id: String) -> bool

Set an auto-generated element ID (used by stateful containers for stable child IDs). Read more
Source§

fn children_builders_mut(&mut self) -> &mut [Box<dyn ElementBuilder>]

Get mutable access to children for auto-ID assignment
Source§

fn element_classes(&self) -> &[String]

Get the element’s CSS class list for selector matching
Source§

fn bound_scroll_ref(&self) -> Option<&ScrollRef>

Get the bound ScrollRef for programmatic scroll control Read more
Source§

fn motion_on_ready_callback( &self, ) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>

Get the on_ready callback for this motion container Read more

Auto Trait Implementations§

§

impl<S> Freeze for BoundStateful<S>

§

impl<S> RefUnwindSafe for BoundStateful<S>

§

impl<S> !Send for BoundStateful<S>

§

impl<S> !Sync for BoundStateful<S>

§

impl<S> Unpin for BoundStateful<S>

§

impl<S> UnsafeUnpin for BoundStateful<S>

§

impl<S> UnwindSafe for BoundStateful<S>

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

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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> 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, 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> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

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