Struct Layout

Source
pub struct Layout {
    pub tree: Tree<Pane>,
    pub popped: Vec<Pane>,
    pub undo: Vec<String>,
    pub redo: Vec<String>,
}
Expand description

The whole layout: the docked tree plus panes currently popped out into their own windows.

Fields§

§tree: Tree<Pane>§popped: Vec<Pane>§undo: Vec<String>

The layout’s own undo history (serialised layouts): the layout is not the project, so it cannot ride the project’s snapshots. Never persisted, and 20 steps is plenty for “put that tab back”.

§redo: Vec<String>

Implementations§

Source§

impl Layout

Source

pub fn default_layout() -> Self

Source

pub fn new(tree: Tree<Pane>) -> Self

A layout around a tree, with an empty history.

Source

pub fn to_json(&self) -> String

Source

pub fn from_json(s: &str) -> Option<Self>

None on malformed / incompatible JSON (caller falls back to the default layout). A layout saved before round 3 knows nothing about Tools / Nodes / Mixer / Markers: rather than dropping four panes into the root as loose tabs, it is rejected here and the caller resets to the new default.

Source

pub fn from_json_migrating(s: &str) -> Option<Self>

Same, but an explicitly saved profile is migrated instead of rejected: panes it predates are added to the root rather than making the whole profile unloadable.

Source

pub fn is_visible(&self, pane: Pane) -> bool

Visible = docked in the tree (and not hidden) or popped out.

Source

pub fn toggle(&mut self, pane: Pane)

Show (back where it was in the tree, or into the root when it is gone) or hide (invisible in the tree / close the popout).

Source

pub fn reveal(&mut self, pane: Pane)

Make the pane visible (docked or popped) and, if it is a tab, the active one.

Source

pub fn popout(&mut self, pane: Pane)

Source

pub fn dock(&mut self, pane: Pane)

Source

pub fn reset(&mut self)

Source

pub fn push_undo(&mut self, snapshot: String)

Remember the arrangement snapshot was taken from (before the move), so Ctrl+Z can go back to it.

Source

pub fn undo(&mut self) -> bool

Source

pub fn redo(&mut self) -> bool

Source

fn step(&mut self, undoing: bool) -> bool

Source

fn insert_into_root(&mut self, pane: Pane)

A pane that fell out of the tree entirely (e.g. an old profile): add it as a new tab in the root.

Trait Implementations§

Source§

impl Clone for Layout

Source§

fn clone(&self) -> Layout

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Layout

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Layout

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Layout

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Layout

§

impl RefUnwindSafe for Layout

§

impl Send for Layout

§

impl Sync for Layout

§

impl Unpin for Layout

§

impl UnwindSafe for Layout

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

§

impl<T> MaybeSend for T

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + Serialize + for<'a> Deserialize<'a> + Send + Sync,