diff --git a/src/api/config.rs b/src/api/config.rs index 8a70a10..f22c183 100644 --- a/src/api/config.rs +++ b/src/api/config.rs @@ -27,10 +27,10 @@ pub struct Config { impl Config { /// construct a new Config object, with given username and password - pub fn new(username: String, password: String) -> Self { + pub fn new(username: impl ToString, password: impl ToString) -> Self { Self { - username, - password, + username: username.to_string(), + password: password.to_string(), host: None, port: None, tls: None, diff --git a/src/workspace.rs b/src/workspace.rs index b474121..a6d0cee 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -278,6 +278,15 @@ impl Workspace { .collect() } + /// Get all names of users currently in this workspace + pub fn user_list(&self) -> Vec { + self.0 + .users + .iter() + .map(|elem| elem.value().name.clone()) + .collect() + } + /// Get the filetree as it is currently cached. /// A filter may be applied, and it may be strict (equality check) or not (starts_with check). // #[cfg_attr(feature = "js", napi)] // https://github.com/napi-rs/napi-rs/issues/1120