logo
pub struct State<T> {
    pub panes: HashMap<Pane, T, RandomState>,
    pub internal: Internal,
    /* private fields */
}
Available on crate feature pure only.
Expand description

The state of a PaneGrid.

It keeps track of the state of each Pane and the position of each Split.

The State needs to own any mutable contents a Pane may need. This is why this struct is generic over the type T. Values of this type are provided to the view function of PaneGrid::new for displaying each Pane.

Fields

panes: HashMap<Pane, T, RandomState>

The panes of the PaneGrid.

internal: Internal

The internal state of the PaneGrid.

Implementations

Creates a new State, initializing the first pane with the provided state.

Alongside the State, it returns the first Pane identifier.

Creates a new State with the given Configuration.

Returns the total amount of panes in the State.

Returns the internal state of the given Pane, if it exists.

Returns the internal state of the given Pane with mutability, if it exists.

Returns an iterator over all the panes of the State, alongside its internal state.

Returns a mutable iterator over all the panes of the State, alongside its internal state.

Returns the layout of the State.

Returns the adjacent Pane of another Pane in the given direction, if there is one.

Splits the given Pane into two in the given Axis and initializing the new Pane with the provided internal state.

Swaps the position of the provided panes in the State.

If you want to swap panes on drag and drop in your PaneGrid, you will need to call this method when handling a DragEvent.

Resizes two panes by setting the position of the provided Split.

The ratio is a value in [0, 1], representing the exact position of a Split between two panes.

If you want to enable resize interactions in your PaneGrid, you will need to call this method when handling a ResizeEvent.

Closes the given Pane and returns its internal state and its closest sibling, if it exists.

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

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.