#[non_exhaustive]pub struct Layout {
pub version: u32,
pub root: LayoutNode,
pub active: EditorGroupId,
pub maximized: Option<EditorGroupId>,
pub zen: bool,
pub closed: VecDeque<LayoutTab>,
pub floating: Vec<FloatingPanel>,
/* private fields */
}state and storage only.Expand description
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.version: u32File format version.
root: LayoutNodeThe tree.
active: EditorGroupIdThe focused group.
maximized: Option<EditorGroupId>A maximized group (the rest are hidden until restored).
zen: boolZen mode hides the side bars, status bar, and activity bar.
closed: VecDeque<LayoutTab>The last closed tabs, newest first.
floating: Vec<FloatingPanel>Free-floating panels, with their screen rectangles.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn groups(&self) -> Vec<EditorGroupId>
pub fn groups(&self) -> Vec<EditorGroupId>
The group ids.
Sourcepub fn group(&self, id: EditorGroupId) -> Option<&EditorGroup>
pub fn group(&self, id: EditorGroupId) -> Option<&EditorGroup>
A group by id.
Sourcepub fn group_mut(&mut self, id: EditorGroupId) -> Option<&mut EditorGroup>
pub fn group_mut(&mut self, id: EditorGroupId) -> Option<&mut EditorGroup>
A group by id, mutably.
Sourcepub fn active_group(&self) -> Option<&EditorGroup>
pub fn active_group(&self) -> Option<&EditorGroup>
The focused group.
Sourcepub fn focus(&mut self, id: EditorGroupId) -> bool
pub fn focus(&mut self, id: EditorGroupId) -> bool
Focus a group.
Sourcepub fn split(
&mut self,
group: EditorGroupId,
direction: SplitDirection,
) -> Option<EditorGroupId>
pub fn split( &mut self, group: EditorGroupId, direction: SplitDirection, ) -> Option<EditorGroupId>
Split group and return the new group id.
The original group keeps the first half; the new group is empty and focused.
Sourcepub fn float(&mut self, panel: FloatingPanel)
pub fn float(&mut self, panel: FloatingPanel)
Open or raise a floating panel.
Sourcepub fn close_floating(&mut self, id: &str) -> bool
pub fn close_floating(&mut self, id: &str) -> bool
Close a floating panel by id.
Sourcepub fn floating_panel(&self, id: &str) -> Option<&FloatingPanel>
pub fn floating_panel(&self, id: &str) -> Option<&FloatingPanel>
A floating panel by id.
Sourcepub fn close_group(&mut self, id: EditorGroupId) -> bool
pub fn close_group(&mut self, id: EditorGroupId) -> bool
Close a group, promoting its sibling. The last group cannot be closed.
Sourcepub fn move_tab(
&mut self,
from: EditorGroupId,
index: usize,
to: EditorGroupId,
target: usize,
) -> bool
pub fn move_tab( &mut self, from: EditorGroupId, index: usize, to: EditorGroupId, target: usize, ) -> bool
Move a tab from one group to another. Returns whether it moved.
Sourcepub fn close_tab(
&mut self,
group: EditorGroupId,
index: usize,
) -> Option<LayoutTab>
pub fn close_tab( &mut self, group: EditorGroupId, index: usize, ) -> Option<LayoutTab>
Close a tab and remember it for Reopen.
Sourcepub fn reopen_closed(&mut self) -> Option<LayoutTab>
pub fn reopen_closed(&mut self) -> Option<LayoutTab>
Reopen the newest closed tab in the focused group.
Sourcepub fn pin_tab(
&mut self,
group: EditorGroupId,
index: usize,
pinned: bool,
) -> bool
pub fn pin_tab( &mut self, group: EditorGroupId, index: usize, pinned: bool, ) -> bool
Pin or unpin a tab.
Sourcepub fn maximize(&mut self, group: Option<EditorGroupId>) -> bool
pub fn maximize(&mut self, group: Option<EditorGroupId>) -> bool
Maximize a group, or restore with None.
Sourcepub fn to_json(&self) -> Result<String, LayoutError>
Available on crate feature serde only.
pub fn to_json(&self) -> Result<String, LayoutError>
serde only.A JSON representation, for a host or a test.
§Errors
When serialization fails (it does not for this type).
Sourcepub fn from_json(json: &str) -> Result<Self, LayoutError>
Available on crate feature serde only.
pub fn from_json(json: &str) -> Result<Self, LayoutError>
serde only.Parse a layout, rejecting a newer version.
§Errors
When the JSON is malformed or the version is newer than Self::VERSION.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Layout
impl<'de> Deserialize<'de> for Layout
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>,
impl StructuralPartialEq for Layout
Auto Trait Implementations§
impl Forget for Layout
impl Freeze for Layoutwhere
*const u8 is !null: Freeze,
PhantomData<LayoutTab>: Freeze,
*const LayoutNode is !null: Freeze,
PhantomData<LayoutNode>: Freeze,
PhantomData<FloatingPanel>: Freeze,
impl Move for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnsafeUnpin for Layoutwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<LayoutTab>: UnsafeUnpin,
*const LayoutNode is !null: UnsafeUnpin,
PhantomData<LayoutNode>: UnsafeUnpin,
PhantomData<FloatingPanel>: UnsafeUnpin,
impl UnwindSafe for Layout
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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