From 9269dc6460e4ef9e42e10fe140e62b86d805fcd9 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 16 Oct 2024 22:14:34 +0200 Subject: [PATCH 1/2] feat: Default for Config --- src/api/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/config.rs b/src/api/config.rs index b23d962..dcea368 100644 --- a/src/api/config.rs +++ b/src/api/config.rs @@ -8,7 +8,7 @@ /// `host`, `port` and `tls` affect all connections to all gRPC services; the /// resulting endpoint is composed like this: /// http{tls?'s':''}://{host}:{port} -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] #[cfg_attr(feature = "js", napi_derive::napi(object))] #[cfg_attr( any(feature = "py", feature = "py-noabi"), From 4df58c8d67f75af603634916ad1b0fe28cc9ac4b Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 16 Oct 2024 22:14:44 +0200 Subject: [PATCH 2/2] docs: updated Config usage examples --- src/ffi/mod.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs index 2fd6fb1..b7040d1 100644 --- a/src/ffi/mod.rs +++ b/src/ffi/mod.rs @@ -7,9 +7,10 @@ //! use codemp::api::controller::{AsyncReceiver, AsyncSender}; // needed for send/recv trait methods //! //! // connect first, api.code.mp is managed by hexed.technology -//! let client = codemp::Client::connect(codemp::api::Config::new( -//! "mail@example.net", "dont-use-this-password" -//! )).await?; +//! let client = codemp::Client::connect(codemp::api::Config { +//! username: "mail@example.net".into(), password: "dont-use-this-password".into(), +//! ..Default::default() +//! }).await?; //! //! // create and join a workspace //! client.create_workspace("some-workspace").await?; @@ -45,7 +46,8 @@ //! //! // connect first, api.code.mp is managed by hexed.technology //! let client = await codemp.connect({ -//! username: "mail@example.net", password: "dont-use-this-password" +//! username: "mail@example.net", +//! password: "dont-use-this-password" //! }); //! //! // create and join a workspace @@ -80,9 +82,10 @@ //! import codemp //! //! # connect first, api.code.mp is managed by hexed.technology -//! client = codemp.connect( -//! codemp.Config('mail@example.net', 'dont-use-this-password') -//! ).wait() +//! client = codemp.connect(codemp.Config( +//! username='mail@example.net', +//! password='dont-use-this-password' +//! )).wait() //! //! # create and join a workspace //! client.create_workspace("some-workspace").wait() @@ -128,7 +131,8 @@ //! //! -- connect first, api.code.mp is managed by hexed.technology //! local client = CODEMP.connect({ -//! username = "mail@example.net", password = "dont-use-this-password" +//! username = "mail@example.net", +//! password = "dont-use-this-password" //! }):await() //! //! -- create and join a workspace @@ -165,9 +169,10 @@ //! import mp.code.*; //! //! // connect first, api.code.mp is managed by hexed.technology -//! Client client = Client.connect( -//! new data.Config("mail@example.net", "dont-use-this-password") -//! ); +//! Client client = Client.connect(new data.Config( +//! "mail@example.net", +//! "dont-use-this-password" +//! )); //! //! // create and join a workspace //! client.createWorkspace("some-workspace");