reference::example_host

Structs

ExampleHost

A display wrapper for documentation/demo examples.

ExampleHost renders every projected child with slot() and offers an optional source drawer driven by an explicit sources manifest.

Properties

title

Type: Property<String>

Title shown in the source drawer.

sources

Type: Property<Vec<ExampleSource>>

Explicit source files related to the projected example subtree.

selected_source

Type: Property<usize>

Selected source index for the drawer tabs.

drawer_open

Type: Property<bool>

Whether the source drawer is visible.

Implementations

on_pre_render
pub fn on_pre_render(&mut self, ctx: &NodeContext)

Keeps the animated drawer progress synchronized with external state writes.

on_resize_mouse_down
pub fn on_resize_mouse_down(&mut self, ctx: &NodeContext, event: Event<MouseDown>)

Starts dragging the source divider when pressed near the handle.

on_resize_mouse_move
pub fn on_resize_mouse_move(&mut self, ctx: &NodeContext, event: Event<MouseMove>)

Updates the fixed-sum preview/source split while dragging.

on_resize_mouse_out
pub fn on_resize_mouse_out(&mut self, ctx: &NodeContext, _event: Event<MouseOut>)

Restores the cursor after leaving the source divider.

on_resize_mouse_over
pub fn on_resize_mouse_over(&mut self, ctx: &NodeContext, _event: Event<MouseOver>)

Shows the platform resize cursor over the source divider.

on_resize_mouse_up
pub fn on_resize_mouse_up(&mut self, ctx: &NodeContext, _event: Event<MouseUp>)

Ends source divider dragging.

on_split_mouse_down
pub fn on_split_mouse_down(&mut self, ctx: &NodeContext, _event: Event<MouseDown>)

Starts dragging from the explicit source divider hit target.

toggle_drawer
pub fn toggle_drawer(&mut self, _ctx: &NodeContext, _event: Event<Click>)

Toggles the source drawer.


ExampleSource

One source file shown by ExampleHost.

Properties

label

Type: String

File label shown in drawer tabs.

language

Type: String

Language label shown in the drawer.

code

Type: String

Source code contents.