pub struct State<T> {
pub panes: HashMap<Pane, T, RandomState>,
pub internal: Internal,
/* private fields */
}
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§
source§impl<T> State<T>
impl<T> State<T>
sourcepub fn with_configuration(config: impl Into<Configuration<T>>) -> State<T>
pub fn with_configuration(config: impl Into<Configuration<T>>) -> State<T>
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
.
sourcepub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)>
pub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)>
Closes the given Pane
and returns its internal state and its closest
sibling, if it exists.
sourcepub fn maximize(&mut self, pane: &Pane)
pub fn maximize(&mut self, pane: &Pane)
Maximize the given Pane
. Only this pane will be rendered by the
PaneGrid
until Self::restore()
is called.
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§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere T: FloatComponent, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere U: FromColor<T>,
source§fn into_color(self) -> U
fn into_color(self) -> U
source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere U: FromColorUnclamped<T>,
source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere U: TryFromColor<T>,
source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more