pub struct TreeUpdate {
    pub nodes: Vec<Node>,
    pub tree: Option<Tree>,
    pub focus: Option<NodeId>,
}
Expand description

A serializable representation of an atomic change to a Tree.

The sender and receiver must be in sync; the update is only meant to bring the tree from a specific previous state into its next state. Trying to apply it to the wrong tree should immediately panic.

Fields

nodes: Vec<Node>

An ordered list of zero or more node updates to apply to the tree.

Suppose that the next Node to be applied is node. The following invariants must hold:

  • Either:
    1. node.id is already in the tree, or
    2. the tree is empty, and node is the new root of the tree.
  • Every child ID in node.children must either be already a child of this node, or a new ID not previously in the tree. It is not allowed to “reparent” a child to this node without first removing that child from its previous parent.
  • When a new ID appears in node.children, the tree should create a new uninitialized placeholder node for it immediately. That placeholder must be updated within the same TreeUpdate, otherwise it’s a fatal error. This guarantees the tree is always complete before or after a TreeUpdate.
tree: Option<Tree>

Rarely updated information about the tree as a whole. This may be omitted if it has not changed since the previous update, but providing the same information again is also allowed. This is required when initializing a tree.

focus: Option<NodeId>

The node with keyboard focus within this tree, if any. If the focus is in a descendant tree, set this to the node to which that tree is anchored. The most recent focus, if any, must be provided with every tree update.

This field must contain a value if and only if the native host (e.g. window) currently has the keyboard focus. This implies that the AccessKit provider must track the native focus state and send matching tree updates. Rationale: A robust GUI toolkit must do this native focus tracking anyway in order to correctly render widgets (e.g. to draw or not draw a focus rectangle), so this focus tracking should not be duplicated between the toolkit and the AccessKit platform adapters.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
The name of the generated JSON Schema. Read more
Generates a JSON Schema for this type. Read more
Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.