pub struct Workspace(/* private fields */);
Expand description
A currently active shared development environment
Workspaces encapsulate a working environment: cursor positions, filetree, user list
and more. Each holds a cursor::Controller
and a map of buffer::Controller
s.
Using a workspace handle, it’s possible to receive events (user join/leave, filetree updates)
and create/delete/attach to new buffers.
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub async fn create_buffer(&self, path: &str) -> RemoteResult<()>
pub async fn create_buffer(&self, path: &str) -> RemoteResult<()>
Create a new buffer in the current workspace.
Sourcepub async fn attach_buffer(&self, path: &str) -> ConnectionResult<Controller>
pub async fn attach_buffer(&self, path: &str) -> ConnectionResult<Controller>
Attach to a buffer and return a handle to it.
Sourcepub fn detach_buffer(&self, path: &str) -> bool
pub fn detach_buffer(&self, path: &str) -> bool
Detach from an active buffer.
This will stop and drop its buffer::Controller
.
Returns true
if it was connectly dropped or wasn’t present, false
if it was dropped but
wasn’t the last existing reference to it. If this method returns false
it means you have
a dangling reference somewhere. It may just be waiting for garbage collection, but as long
as it exists, it will prevent the controller from being completely dropped.
Sourcepub async fn fetch_buffers(&self) -> RemoteResult<Vec<String>>
pub async fn fetch_buffers(&self) -> RemoteResult<Vec<String>>
Re-fetch the list of available buffers in the workspace.
Sourcepub async fn fetch_users(&self) -> RemoteResult<Vec<User>>
pub async fn fetch_users(&self) -> RemoteResult<Vec<User>>
Re-fetch the list of all users in the workspace.
Sourcepub async fn fetch_buffer_users(&self, path: &str) -> RemoteResult<Vec<User>>
pub async fn fetch_buffer_users(&self, path: &str) -> RemoteResult<Vec<User>>
Fetch a list of the Users attached to a specific buffer.
Sourcepub async fn delete_buffer(&self, path: &str) -> RemoteResult<()>
pub async fn delete_buffer(&self, path: &str) -> RemoteResult<()>
Delete a buffer.
Sourcepub fn cursor(&self) -> Controller
pub fn cursor(&self) -> Controller
Return a handle to the cursor::Controller
.
Sourcepub fn get_buffer(&self, path: &str) -> Option<Controller>
pub fn get_buffer(&self, path: &str) -> Option<Controller>
Return a handle to the buffer::Controller with the given path, if present.
Sourcepub fn active_buffers(&self) -> Vec<String>
pub fn active_buffers(&self) -> Vec<String>
Get a list of all the currently attached buffers.
Trait Implementations§
Source§impl AsyncReceiver<Event> for Workspace
impl AsyncReceiver<Event> for Workspace
Source§async fn try_recv(&self) -> ControllerResult<Option<Event>>
async fn try_recv(&self) -> ControllerResult<Option<Event>>
Source§async fn poll(&self) -> ControllerResult<()>
async fn poll(&self) -> ControllerResult<()>
Source§fn clear_callback(&self)
fn clear_callback(&self)
Source§fn callback(&self, cb: impl Into<ControllerCallback<Self>>)
fn callback(&self, cb: impl Into<ControllerCallback<Self>>)
Source§async fn recv(&self) -> ControllerResult<T>
async fn recv(&self) -> ControllerResult<T>
Auto Trait Implementations§
impl Freeze for Workspace
impl !RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl !UnwindSafe for Workspace
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request