pub enum Container {
Tabs(Tabs),
Linear(Linear),
Grid(Grid),
}Expand description
A container of several super::Tiles.
Variants§
Implementations§
Source§impl Container
impl Container
pub fn new(kind: ContainerKind, children: Vec<TileId>) -> Self
pub fn new_linear(dir: LinearDir, children: Vec<TileId>) -> Self
pub fn new_horizontal(children: Vec<TileId>) -> Self
pub fn new_vertical(children: Vec<TileId>) -> Self
pub fn new_tabs(children: Vec<TileId>) -> Self
pub fn new_grid(children: Vec<TileId>) -> Self
pub fn is_empty(&self) -> bool
pub fn num_children(&self) -> usize
Sourcepub fn active_children(&self) -> impl Iterator<Item = &TileId>
pub fn active_children(&self) -> impl Iterator<Item = &TileId>
All the active childrens of this container.
For tabs, this is just the active tab. For other containers, it is all children.
Sourcepub fn only_child(&self) -> Option<TileId>
pub fn only_child(&self) -> Option<TileId>
If we have exactly one child, return it
pub fn children_vec(&self) -> Vec<TileId>
pub fn has_child(&self, needle: TileId) -> bool
pub fn add_child(&mut self, child: TileId)
Sourcepub fn retain(&mut self, retain: impl FnMut(TileId) -> bool)
pub fn retain(&mut self, retain: impl FnMut(TileId) -> bool)
Iterate through all children in order, and keep only those for which the closure returns true.
Sourcepub fn remove_child(&mut self, child: TileId) -> Option<usize>
pub fn remove_child(&mut self, child: TileId) -> Option<usize>
Returns child index, if found.
pub fn kind(&self) -> ContainerKind
pub fn set_kind(&mut self, kind: ContainerKind)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Container
impl<'de> Deserialize<'de> for Container
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Container
Auto Trait Implementations§
impl Freeze for Container
impl RefUnwindSafe for Container
impl Send for Container
impl Sync for Container
impl Unpin for Container
impl UnwindSafe for Container
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more