pub enum ToolbarOp {
Remove {
id: String,
},
Insert {
index: usize,
item: ToolbarItem,
},
}Expand description
One step of an edit to a window’s toolbar (docs/toolbars.md).
Day hands a backend its bar as edits, never as a whole new model to rebuild, for the same
reason the view tree arrives as insert/remove rather than as a fresh tree: an item the
edit does not name keeps its native widget, and with it the keyboard focus, the caret, a
menu that is open. A value (search text, a toggle) never travels as an edit; it is a
ToolbarPatch on the live item.
An edit lists every ToolbarOp::Remove first, then every ToolbarOp::Insert in
ascending index, so applying them in order to the bar’s current items (a
ToolbarMirror does exactly that) produces the new bar. Items keep their relative order
across an edit: an item that moves arrives as a remove and an insert, like one whose
presentation changed.
Variants§
Remove
The item with this id leaves the bar.
Insert
item joins the bar at index, its position once this edit is complete.