pub struct LayoutSnapshot { /* private fields */ }Expand description
Serializable snapshot of a LayoutRuntime
for session persistence.
Strategy runtimes serialize the recipe (strategy config + panel kinds). Non-strategy runtimes serialize the tree topology.
§Example
let mut rt = Layout::master_stack(["editor", "chat", "status"])
.master_ratio(0.6).gap(1.0).into_runtime().unwrap();
let snapshot = rt.snapshot().unwrap();
// Serialize with any serde format:
// let json = serde_json::to_string(&snapshot).unwrap();
// Restore later:
let mut rt2 = panes::runtime::LayoutRuntime::from_snapshot(snapshot).unwrap();Implementations§
Source§impl LayoutSnapshot
impl LayoutSnapshot
Sourcepub fn source(&self) -> &SnapshotSource
pub fn source(&self) -> &SnapshotSource
Returns the snapshot source: a strategy config, tree topology, or adaptive breakpoint set.
Sourcepub fn focused(&self) -> Option<&str>
pub fn focused(&self) -> Option<&str>
Returns the kind of the focused panel at capture time, if any.
Sourcepub fn collapsed(&self) -> &[Box<str>]
pub fn collapsed(&self) -> &[Box<str>]
Returns the kinds of all collapsed panels at capture time.
Sourcepub fn focused_key(&self) -> Option<PanelKey>
pub fn focused_key(&self) -> Option<PanelKey>
Sequence index of the focused panel for deterministic restore.
Sourcepub fn collapsed_keys(&self) -> &[PanelKey]
pub fn collapsed_keys(&self) -> &[PanelKey]
Sequence indices of collapsed panels for deterministic restore.
Sourcepub fn overlays(&self) -> &[SnapshotOverlay]
pub fn overlays(&self) -> &[SnapshotOverlay]
Returns the overlay definitions captured at snapshot time.
Sourcepub fn into_overlays(self) -> Vec<SnapshotOverlay>
pub fn into_overlays(self) -> Vec<SnapshotOverlay>
Consumes the snapshot and returns the overlay definitions as an owned Vec.
Trait Implementations§
Source§impl Clone for LayoutSnapshot
impl Clone for LayoutSnapshot
Source§fn clone(&self) -> LayoutSnapshot
fn clone(&self) -> LayoutSnapshot
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LayoutSnapshot
impl RefUnwindSafe for LayoutSnapshot
impl Send for LayoutSnapshot
impl Sync for LayoutSnapshot
impl Unpin for LayoutSnapshot
impl UnsafeUnpin for LayoutSnapshot
impl UnwindSafe for LayoutSnapshot
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