pub struct WorkspaceManager<'a> {
pub workspaces: HashMap<&'a String, &'a Workspace>,
/* private fields */
}
Fields§
§workspaces: HashMap<&'a String, &'a Workspace>
Implementations§
Source§impl<'a> WorkspaceManager<'a>
impl<'a> WorkspaceManager<'a>
Sourcepub fn from_single_workspace(workspace: &'a Workspace) -> WorkspaceManager<'a>
pub fn from_single_workspace(workspace: &'a Workspace) -> WorkspaceManager<'a>
Creates a new workspace manager with a single workspace, setting it as the default.
workspace
: The single workspace to use
Sourcepub fn new(
workspaces: Vec<&'a Workspace>,
default_workspace: &'a String,
) -> Result<WorkspaceManager<'a>, WorkspaceNotFound>
pub fn new( workspaces: Vec<&'a Workspace>, default_workspace: &'a String, ) -> Result<WorkspaceManager<'a>, WorkspaceNotFound>
Creates a new workspace manager from a list of workspaces. If the default workspace is not found, an error is returned.
workspaces
: A list of workspaces to add to the workspace manager.default_workspace
: The name of the default workspace.
Sourcepub fn get_workspace(&self, name: &String) -> Option<&Workspace>
pub fn get_workspace(&self, name: &String) -> Option<&Workspace>
Returns a workspace with the given name, or None if it doesn’t exist.
name
: The name of the workspace.
Sourcepub fn set_current_workspace(
&mut self,
name: &'a String,
) -> Result<(), WorkspaceNotFound>
pub fn set_current_workspace( &mut self, name: &'a String, ) -> Result<(), WorkspaceNotFound>
Sets the current workspace to the workspace with the given name. Returns unit if the workspace was set, else returns a WorkspaceNotFound error.
name
: The name of the workspace to set as the current workspace.
Sourcepub fn get_current_workspace(&self) -> &'a Workspace
pub fn get_current_workspace(&self) -> &'a Workspace
Returns the current workspace.
Sourcepub fn add_workspace(&mut self, workspace: &'a Workspace)
pub fn add_workspace(&mut self, workspace: &'a Workspace)
Adds a workspace to the list of workspaces. Overwrites any existing workspace with the same name.
workspace
: The workspace to add to the list of workspaces.
Auto Trait Implementations§
impl<'a> Freeze for WorkspaceManager<'a>
impl<'a> RefUnwindSafe for WorkspaceManager<'a>
impl<'a> Send for WorkspaceManager<'a>
impl<'a> Sync for WorkspaceManager<'a>
impl<'a> Unpin for WorkspaceManager<'a>
impl<'a> UnwindSafe for WorkspaceManager<'a>
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