mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-24 16:14:48 +01:00
fix: use async blocks rather than main + async fn
This commit is contained in:
parent
d506d8cc74
commit
d31b3d244a
1 changed files with 8 additions and 12 deletions
20
src/lib.rs
20
src/lib.rs
|
@ -19,8 +19,7 @@
|
||||||
//! a supported remote server and returns a [`Client`] handle to interact with it.
|
//! a supported remote server and returns a [`Client`] handle to interact with it.
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # fn main() {}
|
//! # async {
|
||||||
//! # async fn main_fn() {
|
|
||||||
//! let client = codemp::Client::connect(
|
//! let client = codemp::Client::connect(
|
||||||
//! codemp::api::Config::new(
|
//! codemp::api::Config::new(
|
||||||
//! "mail@example.net",
|
//! "mail@example.net",
|
||||||
|
@ -29,27 +28,25 @@
|
||||||
//! )
|
//! )
|
||||||
//! .await
|
//! .await
|
||||||
//! .expect("failed to connect!");
|
//! .expect("failed to connect!");
|
||||||
//! # }
|
//! # };
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! A [`Client`] can acquire a [`Workspace`] handle by joining an existing one it can access with
|
//! A [`Client`] can acquire a [`Workspace`] handle by joining an existing one it can access with
|
||||||
//! [`Client::join_workspace`] or create a new one with [`Client::create_workspace`].
|
//! [`Client::join_workspace`] or create a new one with [`Client::create_workspace`].
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # fn main() {}
|
//! # async {
|
||||||
//! # async fn main_fn() {
|
|
||||||
//! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap();
|
//! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap();
|
||||||
//! client.create_workspace("my-workspace").await.expect("failed to create workspace!");
|
//! client.create_workspace("my-workspace").await.expect("failed to create workspace!");
|
||||||
//! let workspace = client.join_workspace("my-workspace").await.expect("failed to attach!");
|
//! let workspace = client.join_workspace("my-workspace").await.expect("failed to attach!");
|
||||||
//! # }
|
//! # };
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! A [`Workspace`] handle can be used to acquire a [`cursor::Controller`] to track remote [`api::Cursor`]s
|
//! A [`Workspace`] handle can be used to acquire a [`cursor::Controller`] to track remote [`api::Cursor`]s
|
||||||
//! and one or more [`buffer::Controller`] to send and receive [`api::TextChange`]s.
|
//! and one or more [`buffer::Controller`] to send and receive [`api::TextChange`]s.
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # fn main() {}
|
//! # async {
|
||||||
//! # async fn main_fn() {
|
|
||||||
//! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap();
|
//! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap();
|
||||||
//! # client.create_workspace("").await.unwrap();
|
//! # client.create_workspace("").await.unwrap();
|
||||||
//! # let workspace = client.join_workspace("").await.unwrap();
|
//! # let workspace = client.join_workspace("").await.unwrap();
|
||||||
|
@ -57,7 +54,7 @@
|
||||||
//! let cursor = workspace.cursor();
|
//! let cursor = workspace.cursor();
|
||||||
//! let event = cursor.recv().await.expect("disconnected while waiting for event!");
|
//! let event = cursor.recv().await.expect("disconnected while waiting for event!");
|
||||||
//! println!("user {} moved on buffer {}", event.user.unwrap_or_default(), event.buffer);
|
//! println!("user {} moved on buffer {}", event.user.unwrap_or_default(), event.buffer);
|
||||||
//! # }
|
//! # };
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Internally, [`buffer::Controller`]s store the buffer state as a [diamond_types] CRDT, guaranteeing
|
//! Internally, [`buffer::Controller`]s store the buffer state as a [diamond_types] CRDT, guaranteeing
|
||||||
|
@ -65,8 +62,7 @@
|
||||||
//! guaranteed to converge.
|
//! guaranteed to converge.
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! # fn main() {}
|
//! # async {
|
||||||
//! # async fn main_fn() {
|
|
||||||
//! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap();
|
//! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap();
|
||||||
//! # client.create_workspace("").await.unwrap();
|
//! # client.create_workspace("").await.unwrap();
|
||||||
//! # let workspace = client.join_workspace("").await.unwrap();
|
//! # let workspace = client.join_workspace("").await.unwrap();
|
||||||
|
@ -76,7 +72,7 @@
|
||||||
//! if let Some(change) = buffer.try_recv().await.unwrap() {
|
//! if let Some(change) = buffer.try_recv().await.unwrap() {
|
||||||
//! println!("content: {}, span: {}-{}", change.content, change.start, change.end);
|
//! println!("content: {}, span: {}-{}", change.content, change.start, change.end);
|
||||||
//! } // if None, no changes are currently available
|
//! } // if None, no changes are currently available
|
||||||
//! # }
|
//! # };
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ## FFI
|
//! ## FFI
|
||||||
|
|
Loading…
Reference in a new issue