pub enum Surface<Tab> {
    Empty,
    Main(Tree<Tab>),
    Window(Tree<Tab>, WindowState),
}
Expand description

A Surface is the highest level component in a DockState. Surfaces represent an area in which nodes are placed. Typically, you’re only using one surface, which is the main surface. However, if you drag a tab out in a way which creates a window, you also create a new surface in which nodes can appear.

Variants§

§

Empty

An empty surface, with nothing inside (practically, a null surface).

§

Main(Tree<Tab>)

The main surface of a DockState, only one should exist at surface index 0 at any one time.

§

Window(Tree<Tab>, WindowState)

A windowed surface with a state.

Implementations§

source§

impl<Tab> Surface<Tab>

source

pub const fn is_empty(&self) -> bool

Is this surface Empty (in practice null)?

source

pub fn node_tree(&self) -> Option<&Tree<Tab>>

Get access to the node tree of this surface.

source

pub fn node_tree_mut(&mut self) -> Option<&mut Tree<Tab>>

Get mutable access to the node tree of this surface.

source

pub fn iter_nodes(&self) -> impl Iterator<Item = &Node<Tab>>

Returns an Iterator of nodes in this surface’s tree.

If the surface is Empty, then the returned Iterator will be empty.

source

pub fn iter_nodes_mut(&mut self) -> impl Iterator<Item = &mut Node<Tab>>

Returns a mutable Iterator of nodes in this surface’s tree.

If the surface is Empty, then the returned Iterator will be empty.

source

pub fn iter_all_tabs(&self) -> impl Iterator<Item = (NodeIndex, &Tab)>

Returns an Iterator of all tabs in this surface’s tree, and indices of containing nodes.

source

pub fn iter_all_tabs_mut( &mut self ) -> impl Iterator<Item = (NodeIndex, &mut Tab)>

Returns a mutable Iterator of all tabs in this surface’s tree, and indices of containing nodes.

source

pub fn filter_map_tabs<F, NewTab>(&self, function: F) -> Surface<NewTab>
where F: Clone + FnMut(&Tab) -> Option<NewTab>,

Returns a new Surface while mapping and filtering the tab type. Any remaining empty Nodes and are removed, and if this Surface remains empty, it’ll change to Surface::Empty.

source

pub fn map_tabs<F, NewTab>(&self, function: F) -> Surface<NewTab>
where F: Clone + FnMut(&Tab) -> NewTab,

Returns a new Surface while mapping the tab type.

source

pub fn filter_tabs<F>(&self, predicate: F) -> Surface<Tab>
where F: Clone + FnMut(&Tab) -> bool, Tab: Clone,

Returns a new Surface while filtering the tab type. Any remaining empty Nodes and are removed, and if this Surface remains empty, it’ll change to Surface::Empty.

source

pub fn retain_tabs<F>(&mut self, predicate: F)
where F: Clone + FnMut(&mut Tab) -> bool,

Removes all tabs for which predicate returns false. Any remaining empty Nodes and are also removed, and if this Surface remains empty, it’ll change to Surface::Empty.

Trait Implementations§

source§

impl<Tab: Clone> Clone for Surface<Tab>

source§

fn clone(&self) -> Surface<Tab>

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<Tab: Debug> Debug for Surface<Tab>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Tab> Freeze for Surface<Tab>

§

impl<Tab> RefUnwindSafe for Surface<Tab>
where Tab: RefUnwindSafe,

§

impl<Tab> Send for Surface<Tab>
where Tab: Send,

§

impl<Tab> Sync for Surface<Tab>
where Tab: Sync,

§

impl<Tab> Unpin for Surface<Tab>
where Tab: Unpin,

§

impl<Tab> UnwindSafe for Surface<Tab>
where Tab: UnwindSafe,

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

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

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

§

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>,

§

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.
source§

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