pub struct State<T> { /* 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
.
Implementations
sourceimpl<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
.
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<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
sourcefn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.