pub struct Zone {
pub name: ZoneName,
pub kind: ZoneKind,
pub constraints: Constraints,
pub state: ZoneState,
}Expand description
One zone of the tree: a split of zones, or a leaf with content.
Fields§
§name: ZoneNameIts name, unique in the layout.
kind: ZoneKindA split or a leaf.
constraints: ConstraintsIts bounds and behaviour, set from code (never saved).
state: ZoneStateWhat the user changed (saved).
Implementations§
Source§impl Zone
impl Zone
Sourcepub fn leaf(name: impl Into<ZoneName>, content: Content) -> Self
pub fn leaf(name: impl Into<ZoneName>, content: Content) -> Self
A leaf zone with default constraints and state.
Sourcepub fn split(name: impl Into<ZoneName>, dir: Dir, children: Vec<Self>) -> Self
pub fn split(name: impl Into<ZoneName>, dir: Dir, children: Vec<Self>) -> Self
A split zone with default constraints and state.
Sourcepub fn with(self, constrain: impl FnOnce(&mut Constraints)) -> Self
pub fn with(self, constrain: impl FnOnce(&mut Constraints)) -> Self
The zone with its constraints changed by constrain.
Sourcepub fn with_state(self, change: impl FnOnce(&mut ZoneState)) -> Self
pub fn with_state(self, change: impl FnOnce(&mut ZoneState)) -> Self
The zone with its state changed by change.
Sourcepub fn visit_mut(&mut self, visit: &mut impl FnMut(&mut Self))
pub fn visit_mut(&mut self, visit: &mut impl FnMut(&mut Self))
Calls visit on this zone and every zone under it, parents first,
mutably.
Trait Implementations§
impl StructuralPartialEq for Zone
Auto Trait Implementations§
impl Forget for Zone
impl Freeze for Zone
impl Move for Zone
impl RefUnwindSafe for Zone
impl Send for Zonewhere
RawVecInner: Send,
impl Sync for Zonewhere
RawVecInner: Sync,
impl Unpin for Zone
impl UnsafeUnpin for Zonewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Zone>: UnsafeUnpin,
impl UnwindSafe for Zonewhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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