pub enum WidgetMutation {
SetValue {
widget_key: String,
value: String,
cursor_byte: Option<i32>,
},
SetCompletions {
widget_key: String,
items: Vec<CompletionItem>,
},
SetChecked {
widget_key: String,
checked: bool,
},
SetSelectedIndex {
widget_key: String,
index: i32,
},
SetItems {
widget_key: String,
items: Vec<TextPropertyEntry>,
item_keys: Vec<String>,
},
SetExpandedKeys {
widget_key: String,
keys: Vec<String>,
},
SetCheckedKeys {
widget_key: String,
checked: bool,
keys: Vec<String>,
},
AppendTreeNodes {
widget_key: String,
new_nodes: Vec<TreeNode>,
new_item_keys: Vec<String>,
},
SetRawEntries {
widget_key: String,
entries: Vec<TextPropertyEntry>,
},
SetFocusKey {
widget_key: String,
},
}Expand description
Targeted in-place mutation of a mounted widget panel — the IPC fast path. Plugins use these when the model change touches one widget; the host applies the mutation directly to the panel’s spec / instance state and re-renders without re-transmitting the full spec.
UpdateWidgetPanel remains the right tool for structural
changes (adding/removing widgets, restructuring layout). Both
paths preserve instance state via widget keys.
Variants§
SetValue
Set a TextInput’s value and (optionally) cursor byte.
Mutates instance state directly.
SetCompletions
Set a Text widget’s completion candidates (instance
state). Empty items closes the popup; non-empty opens
it and resets the selection to index 0. Plugins call
this from their change event handler after computing
candidates against the new value — same flow as
setPromptSuggestions for the legacy prompt UI.
SetChecked
Set a Toggle’s checked state. Mutates the Toggle’s
checked field in the spec.
SetSelectedIndex
Set a List’s selected index (instance state).
SetItems
Replace a List’s items + parallel item_keys. Mutates
the List in the spec.
SetExpandedKeys
Replace a Tree’s expanded-keys instance state. Plugins use
this when a non-user action needs to drive expansion (e.g.
“expand all”, reveal-on-search). Right/Left arrow keys
and disclosure clicks already mutate expansion host-side
without the plugin’s involvement.
SetCheckedKeys
Set checked to the given value on every node in keys.
Mutates the Tree’s nodes in the spec; the renderer sees
the change on the next paint without a full spec re-emit.
Used by the toggle event handler in plugins to push the
new checkbox state back after a user click or x keypress.
AppendTreeNodes
Append new_nodes (and parallel new_item_keys) to an
existing Tree’s node list. Streaming-friendly counterpart to
SetItems: a plugin streaming thousands of results sends only
the per-batch delta instead of re-transmitting the entire tree
on every batch. Existing selection / scroll / expansion state
is preserved across the append.
SetRawEntries
Replace a Raw widget’s entries in place. The streaming search
pump uses this to update small bits of chrome (the matchStats
label, the separator “Matches (N in M files)” header) without
re-emitting the full panel spec — the latter would force a
js_to_json walk of every node in a 5 000-row tree once
streaming finishes, blocking the JS thread for ~1 second.
SetFocusKey
Set the panel’s focused widget to widget_key. Passing a key
that isn’t a tabbable in the current spec is harmless — the
next render clamps focus to the first tabbable, same as for an
empty key. Use this to land initial focus on a specific widget
after mount, or to snap focus back to a “home” widget after a
navigation event.
Trait Implementations§
Source§impl Clone for WidgetMutation
impl Clone for WidgetMutation
Source§fn clone(&self) -> WidgetMutation
fn clone(&self) -> WidgetMutation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WidgetMutation
impl Debug for WidgetMutation
Source§impl<'de> Deserialize<'de> for WidgetMutation
impl<'de> Deserialize<'de> for WidgetMutation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for WidgetMutation
impl Serialize for WidgetMutation
Source§impl TS for WidgetMutation
impl TS for WidgetMutation
Source§type WithoutGenerics = WidgetMutation
type WithoutGenerics = WidgetMutation
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = WidgetMutation
type OptionInnerType = WidgetMutation
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
Source§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all. Read moreSource§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export. Read more