#[non_exhaustive]pub struct Workspace {Show 15 fields
pub version: u32,
pub theme: ThemeId,
pub follow_system: bool,
pub reduced_motion: bool,
pub documents: Vec<WorkspaceDocument>,
pub active: usize,
pub explorer: Vec<String>,
pub panels: WorkspacePanels,
pub sidebar_width: f32,
pub right_width: f32,
pub bottom_height: f32,
pub plot_views: BTreeMap<String, WorkspacePlotView>,
pub layout: Layout,
pub named_layouts: BTreeMap<String, Layout>,
pub active_layout: String,
}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.
theme: ThemeIdRequested theme.
follow_system: boolFollow the desktop light/dark preference.
reduced_motion: boolReduced motion.
documents: Vec<WorkspaceDocument>Open documents, in tab order.
active: usizeActive document index (clamped on load).
explorer: Vec<String>Expanded explorer keys.
panels: WorkspacePanelsVisible panels.
Left panel width.
right_width: f32Right panel width.
bottom_height: f32Bottom panel height.
plot_views: BTreeMap<String, WorkspacePlotView>Plot views by plot id.
layout: LayoutThe current editor layout.
named_layouts: BTreeMap<String, Layout>Named layouts (“Analysis”, “Review”) that can be switched from the palette.
active_layout: StringThe name of the active named layout.
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn with_documents(documents: Vec<WorkspaceDocument>) -> Self
pub fn with_documents(documents: Vec<WorkspaceDocument>) -> Self
A workspace with documents.
Sourcepub fn add_document(&mut self, document: WorkspaceDocument) -> usize
pub fn add_document(&mut self, document: WorkspaceDocument) -> usize
Add a document and return its index.
Sourcepub fn active_document(&self) -> Option<&WorkspaceDocument>
pub fn active_document(&self) -> Option<&WorkspaceDocument>
The active document.
Sourcepub fn set_active(&mut self, index: usize) -> bool
pub fn set_active(&mut self, index: usize) -> bool
Select an existing document.
Sourcepub fn save_layout(&mut self, name: impl Into<String>) -> String
pub fn save_layout(&mut self, name: impl Into<String>) -> String
Save the current layout under a name and return the name.
Sourcepub fn switch_layout(&mut self, name: &str) -> bool
pub fn switch_layout(&mut self, name: &str) -> bool
Switch to a named layout. Returns whether it existed.
Sourcepub fn to_json(&self) -> Result<String, SessionError>
pub fn to_json(&self) -> Result<String, SessionError>
Sourcepub fn from_json(json: &str) -> Result<Self, SessionError>
pub fn from_json(json: &str) -> Result<Self, SessionError>
Parse a workspace, migrating an older version and rejecting a newer one.
§Errors
When the JSON is malformed or the version is newer than Self::VERSION.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Workspace
impl<'de> Deserialize<'de> for Workspace
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 Workspace
Auto Trait Implementations§
impl Forget for Workspace
impl Freeze for Workspacewhere
*const u8 is !null: Freeze,
PhantomData<WorkspaceDocument>: Freeze,
PhantomData<String>: Freeze,
*const LeafNode<String, WorkspacePlotView> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, WorkspacePlotView)>>: Freeze,
PhantomData<LayoutTab>: Freeze,
*const LayoutNode is !null: Freeze,
PhantomData<LayoutNode>: Freeze,
PhantomData<FloatingPanel>: Freeze,
*const LeafNode<String, Layout> is !null: Freeze,
PhantomData<Box<(String, Layout)>>: Freeze,
PhantomData<u8>: Freeze,
impl Move for Workspace
impl RefUnwindSafe for Workspace
impl Send for Workspacewhere
RawVecInner: Send,
NodeRef<Owned, String, Value, LeafOrInternal>: Send,
BoxRaw<(String, Value)>: Send,
NodeRef<Owned, String, WorkspacePlotView, LeafOrInternal>: Send,
BoxRaw<(String, WorkspacePlotView)>: Send,
BoxRaw<LayoutNode>: Send,
NodeRef<Owned, String, Layout, LeafOrInternal>: Send,
BoxRaw<(String, Layout)>: Send,
impl Sync for Workspacewhere
RawVecInner: Sync,
NodeRef<Owned, String, Value, LeafOrInternal>: Sync,
BoxRaw<(String, Value)>: Sync,
NodeRef<Owned, String, WorkspacePlotView, LeafOrInternal>: Sync,
BoxRaw<(String, WorkspacePlotView)>: Sync,
BoxRaw<LayoutNode>: Sync,
NodeRef<Owned, String, Layout, LeafOrInternal>: Sync,
BoxRaw<(String, Layout)>: Sync,
impl Unpin for Workspacewhere
*const u8 is !null: Unpin,
*const LeafNode<String, Value> is !null: Unpin,
Box<(String, Value)>: Unpin,
*const LeafNode<String, WorkspacePlotView> is !null: Unpin,
Box<(String, WorkspacePlotView)>: Unpin,
Box<LayoutNode>: Unpin,
*const LeafNode<String, Layout> is !null: Unpin,
Box<(String, Layout)>: Unpin,
impl UnsafeUnpin for Workspacewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<WorkspaceDocument>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const LeafNode<String, WorkspacePlotView> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, WorkspacePlotView)>>: UnsafeUnpin,
PhantomData<LayoutTab>: UnsafeUnpin,
*const LayoutNode is !null: UnsafeUnpin,
PhantomData<LayoutNode>: UnsafeUnpin,
PhantomData<FloatingPanel>: UnsafeUnpin,
*const LeafNode<String, Layout> is !null: UnsafeUnpin,
PhantomData<Box<(String, Layout)>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for Workspacewhere
RawVecInner: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
BTreeMap<String, WorkspacePlotView>: UnwindSafe,
BoxRaw<LayoutNode>: UnwindSafe,
BTreeMap<String, Layout>: UnwindSafe,
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