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>The panes of the PaneGrid.
internal: InternalThe internal state of the PaneGrid.
Implementations
sourceimpl<T> State<T>
impl<T> State<T>
sourcepub fn with_configuration(config: impl Into<Configuration<T>>) -> Self
pub fn with_configuration(config: impl Into<Configuration<T>>) -> Self
Creates a new State with the given Configuration.
sourcepub fn get(&self, pane: &Pane) -> Option<&T>
pub fn get(&self, pane: &Pane) -> Option<&T>
Returns the internal state of the given Pane, if it exists.
sourcepub fn get_mut(&mut self, pane: &Pane) -> Option<&mut T>
pub fn get_mut(&mut self, pane: &Pane) -> Option<&mut T>
Returns the internal state of the given Pane with mutability, if it
exists.
sourcepub fn iter(&self) -> impl Iterator<Item = (&Pane, &T)>
pub fn iter(&self) -> impl Iterator<Item = (&Pane, &T)>
Returns an iterator over all the panes of the State, alongside its
internal state.
sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = (&Pane, &mut T)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&Pane, &mut T)>
Returns a mutable iterator over all the panes of the State,
alongside its internal state.
sourcepub fn resize(&mut self, split: &Split, ratio: f32)
pub fn resize(&mut self, split: &Split, ratio: f32)
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.
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for State<T> where
T: RefUnwindSafe,
impl<T> Send for State<T> where
T: Send,
impl<T> Sync for State<T> where
T: Sync,
impl<T> Unpin for State<T> where
T: Unpin,
impl<T> UnwindSafe for State<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more