mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-25 22:34:54 +01:00
feat: add user_list, allow config::new with &str
This commit is contained in:
parent
9218e9e9c7
commit
2f6557f971
2 changed files with 12 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -278,6 +278,15 @@ impl Workspace {
|
|||
.collect()
|
||||
}
|
||||
|
||||
/// Get all names of users currently in this workspace
|
||||
pub fn user_list(&self) -> Vec<String> {
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue