pub struct CollaborationManager { /* private fields */ }Expand description
Collaboration manager
Implementations§
Source§impl CollaborationManager
impl CollaborationManager
Sourcepub fn new(
storage_dir: PathBuf,
settings: CollaborationManagerSettings,
) -> Result<Self>
pub fn new( storage_dir: PathBuf, settings: CollaborationManagerSettings, ) -> Result<Self>
Create a new collaboration manager rooted at storage_dir, creating the
directory on disk if it does not already exist.
Sourcepub fn create_workspace(
&mut self,
name: &str,
owner: UserInfo,
) -> Result<String>
pub fn create_workspace( &mut self, name: &str, owner: UserInfo, ) -> Result<String>
Create and register a new workspace owned by owner, enforcing the
configured per-user workspace limit.
Sourcepub fn get_workspace(&self, id: &str) -> Option<&CollaborativeWorkspace>
pub fn get_workspace(&self, id: &str) -> Option<&CollaborativeWorkspace>
Look up a workspace by ID.
Sourcepub fn get_workspace_mut(
&mut self,
id: &str,
) -> Option<&mut CollaborativeWorkspace>
pub fn get_workspace_mut( &mut self, id: &str, ) -> Option<&mut CollaborativeWorkspace>
Look up a workspace by ID, mutably.
Sourcepub fn list_workspaces(&self) -> impl Iterator<Item = &CollaborativeWorkspace>
pub fn list_workspaces(&self) -> impl Iterator<Item = &CollaborativeWorkspace>
Iterate over all registered workspaces.
Sourcepub fn remove_workspace(&mut self, id: &str) -> Option<CollaborativeWorkspace>
pub fn remove_workspace(&mut self, id: &str) -> Option<CollaborativeWorkspace>
Remove and return a workspace from the manager (does not touch disk).
Sourcepub fn save_workspace(&self, id: &str) -> Result<PathBuf>
pub fn save_workspace(&self, id: &str) -> Result<PathBuf>
Persist a registered workspace to <storage_dir>/<id>.json.
Sourcepub fn load_workspace(&mut self, id: &str) -> Result<()>
pub fn load_workspace(&mut self, id: &str) -> Result<()>
Load a workspace previously saved with Self::save_workspace back
into the manager, overwriting any in-memory copy with the same ID.
Sourcepub fn settings(&self) -> &CollaborationManagerSettings
pub fn settings(&self) -> &CollaborationManagerSettings
Manager-wide settings.
Sourcepub fn storage_dir(&self) -> &Path
pub fn storage_dir(&self) -> &Path
Storage directory backing Self::save_workspace / Self::load_workspace.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CollaborationManager
impl RefUnwindSafe for CollaborationManager
impl Send for CollaborationManager
impl Sync for CollaborationManager
impl Unpin for CollaborationManager
impl UnsafeUnpin for CollaborationManager
impl UnwindSafe for CollaborationManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.