From a9d17bf6300ce7f9b88b01baa61883e7168cd1f6 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 15 Oct 2024 19:31:21 +0200 Subject: [PATCH] chore: added explicit target to names, consistency --- src/client.rs | 4 ++-- src/workspace.rs | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client.rs b/src/client.rs index 7cba102..90ba517 100644 --- a/src/client.rs +++ b/src/client.rs @@ -153,7 +153,7 @@ impl Client { } /// Join and return a [`Workspace`]. - pub async fn join_workspace(&self, workspace: impl AsRef) -> ConnectionResult { + pub async fn attach_workspace(&self, workspace: impl AsRef) -> ConnectionResult { let token = self .0 .session @@ -203,7 +203,7 @@ impl Client { } /// Get the currently logged in user. - pub fn user(&self) -> &User { + pub fn my_user(&self) -> &User { &self.0.user } } diff --git a/src/workspace.rs b/src/workspace.rs index fe14388..94c8d37 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -140,7 +140,7 @@ impl Workspace { } /// Create a new buffer in the current workspace. - pub async fn create(&self, path: &str) -> RemoteResult<()> { + pub async fn create_buffer(&self, path: &str) -> RemoteResult<()> { let mut workspace_client = self.0.services.ws(); workspace_client .create_buffer(tonic::Request::new(BufferNode { @@ -158,7 +158,7 @@ impl Workspace { } /// Attach to a buffer and return a handle to it. - pub async fn attach(&self, path: &str) -> ConnectionResult { + pub async fn attach_buffer(&self, path: &str) -> ConnectionResult { let mut worskspace_client = self.0.services.ws(); let request = tonic::Request::new(BufferNode { path: path.to_string(), @@ -190,7 +190,7 @@ impl Workspace { /// If this method returns `false` you have a dangling ref, maybe just waiting for garbage /// collection or maybe preventing the controller from being dropped completely #[allow(clippy::redundant_pattern_matching)] // all cases are clearer this way - pub fn detach(&self, path: &str) -> bool { + pub fn detach_buffer(&self, path: &str) -> bool { match self.0.buffers.remove(path) { None => true, // noop: we werent attached in the first place Some((_name, controller)) => match Arc::into_inner(controller.0) { @@ -256,8 +256,8 @@ impl Workspace { } /// Delete a buffer. - pub async fn delete(&self, path: &str) -> RemoteResult<()> { - self.detach(path); // just in case + pub async fn delete_buffer(&self, path: &str) -> RemoteResult<()> { + self.detach_buffer(path); // just in case let mut workspace_client = self.0.services.ws(); workspace_client @@ -285,13 +285,13 @@ impl Workspace { /// Return a handle to the [buffer::Controller] with the given path, if present. // #[cfg_attr(feature = "js", napi)] // https://github.com/napi-rs/napi-rs/issues/1120 - pub fn buffer_by_name(&self, path: &str) -> Option { + pub fn get_buffer(&self, path: &str) -> Option { self.0.buffers.get(path).map(|x| x.clone()) } /// Get a list of all the currently attached buffers. // #[cfg_attr(feature = "js", napi)] // https://github.com/napi-rs/napi-rs/issues/1120 - pub fn buffer_list(&self) -> Vec { + pub fn active_buffers(&self) -> Vec { self.0 .buffers .iter()