Skip to main content

Component

Trait Component 

Source
pub trait Component {
Show 15 methods // Required methods fn render(&self) -> Node; fn dispatch(&mut self, element_id: &str, event: &str) -> bool; // Provided methods fn render_shared(&self) -> Rc<Node> { ... } fn scene_dirty(&self) -> bool { ... } fn close_requested(&mut self) -> bool { ... } fn take_window_close_request(&mut self) -> bool { ... } fn take_window_commands(&mut self) -> Vec<WindowCommand> { ... } fn publish_window_status(&self, _status: WindowStatus) { ... } fn list_rows(&self, _path: &[usize], _rows: Range<usize>) -> Vec<Node> { ... } fn edit_at(&mut self, _scene: &Node, _path: &[usize], _text: String) -> bool { ... } fn commit_table_cell( &mut self, _scene: &Node, _path: &[usize], _original: &str, _text: String, ) -> bool { ... } fn adjust_range_at( &mut self, _scene: &Node, _path: &[usize], _action: RangeAction, ) -> bool { ... } fn control_at( &mut self, _scene: &Node, _path: &[usize], _action: ControlAction, ) -> bool { ... } fn resize_split_at( &mut self, _scene: &Node, _path: &[usize], _weights: &[(usize, f32)], ) -> bool { ... } fn dispatch_at(&mut self, scene: &Node, path: &[usize], event: &str) -> bool { ... }
}
Expand description

The backend-independent interface implemented by generated UI components.

Required Methods§

Source

fn render(&self) -> Node

Source

fn dispatch(&mut self, element_id: &str, event: &str) -> bool

Provided Methods§

Source

fn render_shared(&self) -> Rc<Node>

Return the current scene. Reactive components may reuse a clean snapshot.

Source

fn scene_dirty(&self) -> bool

Report invalidation caused by a shared reactive dependency.

Source

fn close_requested(&mut self) -> bool

Decide whether the host may close this window.

Source

fn take_window_close_request(&mut self) -> bool

Consume a close command emitted by the component.

Source

fn take_window_commands(&mut self) -> Vec<WindowCommand>

Consume presentation commands in the order emitted by the component.

Source

fn publish_window_status(&self, _status: WindowStatus)

Publish native state after reading it from the window backend.

Source

fn list_rows(&self, _path: &[usize], _rows: Range<usize>) -> Vec<Node>

Render the requested model rows of a virtual view in a base scene.

Source

fn edit_at(&mut self, _scene: &Node, _path: &[usize], _text: String) -> bool

Commit the complete value of an editable text item after input validation.

Source

fn commit_table_cell( &mut self, _scene: &Node, _path: &[usize], _original: &str, _text: String, ) -> bool

Commit a TableCell or TreeCell draft only if its model row and original value still match.

Source

fn adjust_range_at( &mut self, _scene: &Node, _path: &[usize], _action: RangeAction, ) -> bool

Apply a range control action through the same path used by pointer and keyboard input.

Source

fn control_at( &mut self, _scene: &Node, _path: &[usize], _action: ControlAction, ) -> bool

Source

fn resize_split_at( &mut self, _scene: &Node, _path: &[usize], _weights: &[(usize, f32)], ) -> bool

Source

fn dispatch_at(&mut self, scene: &Node, path: &[usize], event: &str) -> bool

Dispatch to the node hit by the backend. IDs may repeat in component instances.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Component + ?Sized> Component for Box<T>

Source§

fn render(&self) -> Node

Source§

fn render_shared(&self) -> Rc<Node>

Source§

fn scene_dirty(&self) -> bool

Source§

fn close_requested(&mut self) -> bool

Source§

fn take_window_close_request(&mut self) -> bool

Source§

fn take_window_commands(&mut self) -> Vec<WindowCommand>

Source§

fn publish_window_status(&self, status: WindowStatus)

Source§

fn list_rows(&self, path: &[usize], rows: Range<usize>) -> Vec<Node>

Source§

fn dispatch(&mut self, element_id: &str, event: &str) -> bool

Source§

fn edit_at(&mut self, scene: &Node, path: &[usize], text: String) -> bool

Source§

fn commit_table_cell( &mut self, scene: &Node, path: &[usize], original: &str, text: String, ) -> bool

Source§

fn adjust_range_at( &mut self, scene: &Node, path: &[usize], action: RangeAction, ) -> bool

Source§

fn control_at( &mut self, scene: &Node, path: &[usize], action: ControlAction, ) -> bool

Source§

fn resize_split_at( &mut self, scene: &Node, path: &[usize], weights: &[(usize, f32)], ) -> bool

Source§

fn dispatch_at(&mut self, scene: &Node, path: &[usize], event: &str) -> bool

Implementors§