pub struct DockLayout { /* private fields */ }Expand description
Describes a layout without constructing any entity.
Building a layout used to require window and cx because every node was
an entity. Now a layout is data, and DockArea reconciles it into entities
when it is installed.
Misuse — a panel added to a split, a child container added to a tab group,
an active index on anything but a tab group — trips a debug_assert! and
is otherwise ignored, matching how the old DockItem::active_index guarded
itself. A type-state builder would reject the same mistakes at compile
time, but it needs four marker types and leaks into every consumer
signature; the runtime assertion is proportionate for a builder whose
misuse shows up on the first debug run.
Implementations§
Source§impl DockLayout
impl DockLayout
Sourcepub fn child(self, child: DockLayout, size: Option<Pixels>) -> Self
pub fn child(self, child: DockLayout, size: Option<Pixels>) -> Self
Add a child container to a split. size is the child’s slot along the
split’s axis; None leaves it unconstrained.
Sourcepub fn panel_view(self, panel: Arc<dyn PanelView>, cx: &App) -> Self
pub fn panel_view(self, panel: Arc<dyn PanelView>, cx: &App) -> Self
Add an already-wrapped panel handle to a tab group.
The companion to Self::panel, for a layer that hands base its own
concrete handle — see PanelView::as_any — rather than a bare
entity. cx is here because the id has to come from
PanelView::panel_id: unlike Self::panel, there is no entity in
hand to take it from.
Sourcepub fn active_index(self, ix: usize) -> Self
pub fn active_index(self, ix: usize) -> Self
Which tab is displayed. Out-of-range values are clamped by
normalize once the layout is installed.
Auto Trait Implementations§
impl !RefUnwindSafe for DockLayout
impl !UnwindSafe for DockLayout
impl Forget for DockLayout
impl Freeze for DockLayoutwhere
*const u8 is !null: Freeze,
PhantomData<(DockLayout, Option<Pixels>)>: Freeze,
PhantomData<(PanelId, Arc<dyn PanelView>)>: Freeze,
impl Move for DockLayout
impl Send for DockLayout
impl Sync for DockLayout
impl Unpin for DockLayout
impl UnsafeUnpin for DockLayoutwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<(DockLayout, Option<Pixels>)>: UnsafeUnpin,
PhantomData<(PanelId, Arc<dyn PanelView>)>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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