Struct WorkspaceManager

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

Source

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
Source

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

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

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

pub fn get_current_workspace(&self) -> &'a Workspace

Returns the current workspace.

Source

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