From e1e09cb20e4e876a62364b882481244a7a0b4502 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Wed, 16 Oct 2024 00:51:52 +0200 Subject: [PATCH] fix: doctests --- src/ffi/mod.rs | 26 +++++++++++++------------- src/lib.rs | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs index 686045b..0de8500 100644 --- a/src/ffi/mod.rs +++ b/src/ffi/mod.rs @@ -13,11 +13,11 @@ //! //! // create and join a workspace //! client.create_workspace("some-workspace").await?; -//! let workspace = client.join_workspace("some-workspace").await?; +//! let workspace = client.attach_workspace("some-workspace").await?; //! //! // create a new buffer in this workspace and attach to it -//! workspace.create("/my/file.txt").await?; -//! let buffer = workspace.attach("/my/file.txt").await?; +//! workspace.create_buffer("/my/file.txt").await?; +//! let buffer = workspace.attach_buffer("/my/file.txt").await?; //! //! // write `hello!` at the beginning of this buffer //! buffer.send(codemp::api::TextChange { @@ -49,12 +49,12 @@ //! }); //! //! // create and join a workspace -//! await client.create_workspace("some-workspace"); -//! let workspace = await client.join_workspace("some-workspace"); +//! await client.createWorkspace("some-workspace"); +//! let workspace = await client.attachWorkspace("some-workspace"); //! //! // create a new buffer in this workspace and attach to it -//! await workspace.create("/my/file.txt"); -//! let buffer = await workspace.attach("/my/file.txt"); +//! await workspace.createBuffer("/my/file.txt"); +//! let buffer = await workspace.attachBuffer("/my/file.txt"); //! //! // write `hello!` at the beginning of this buffer //! await buffer.send({ @@ -87,11 +87,11 @@ //! //! # create and join a workspace //! client.create_workspace("some-workspace").wait() -//! workspace = client.join_workspace("some-workspace").wait() +//! workspace = client.attach_workspace("some-workspace").wait() //! //! # create a new buffer in this workspace and attach to it //! workspace.create("/my/file.txt").wait() -//! buffer = workspace.attach("/my/file.txt").wait() +//! buffer = workspace.attach_buffer("/my/file.txt").wait() //! //! # write `hello!` at the beginning of this buffer //! buffer.send( @@ -132,7 +132,7 @@ //! //! -- create and join a workspace //! client:create_workspace("my-workspace"):await() -//! local workspace = client:join_workspace("my-workspace"):await() +//! local workspace = client:attach_workspace("my-workspace"):await() //! //! -- create a new buffer in this workspace and attach to it //! workspace:create_buffer("/my/file.txt"):await() @@ -170,11 +170,11 @@ //! //! // create and join a workspace //! client.createWorkspace("some-workspace"); -//! Workspace workspace = client.joinWorkspace("some-workspace"); +//! Workspace workspace = client.attachWorkspace("some-workspace"); //! //! // create a new buffer in this workspace and attach to it //! workspace.createBuffer("/my/file.txt"); -//! BufferController buffer = workspace.attachToBuffer("/my/file.txt"); +//! BufferController buffer = workspace.attachBuffer("/my/file.txt"); //! //! // write `hello!` at the beginning of this buffer //! buffer.send(new data.TextChange( @@ -184,7 +184,7 @@ //! //! // wait for cursor movements //! while (true) { -//! data.Cursor event = workspace.getCursor().recv(); +//! data.Cursor event = workspace.cursor().recv(); //! System.out.printf("user %s moved on buffer %s\n", event.user, event.buffer); //! } //! ``` diff --git a/src/lib.rs b/src/lib.rs index 8ddf2c8..304e7c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,13 +32,13 @@ //! ``` //! //! 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::attach_workspace`] or create a new one with [`Client::create_workspace`]. //! //! ```no_run //! # async { //! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap(); //! 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.attach_workspace("my-workspace").await.expect("failed to attach!"); //! # }; //! ``` //! @@ -49,7 +49,7 @@ //! # async { //! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap(); //! # client.create_workspace("").await.unwrap(); -//! # let workspace = client.join_workspace("").await.unwrap(); +//! # let workspace = client.attach_workspace("").await.unwrap(); //! use codemp::api::controller::{AsyncSender, AsyncReceiver}; // needed to access trait methods //! let cursor = workspace.cursor(); //! let event = cursor.recv().await.expect("disconnected while waiting for event!"); @@ -65,9 +65,9 @@ //! # async { //! # let client = codemp::Client::connect(codemp::api::Config::new("", "")).await.unwrap(); //! # client.create_workspace("").await.unwrap(); -//! # let workspace = client.join_workspace("").await.unwrap(); +//! # let workspace = client.attach_workspace("").await.unwrap(); //! # use codemp::api::controller::{AsyncSender, AsyncReceiver}; -//! let buffer = workspace.attach("/some/file.txt").await.expect("failed to attach"); +//! let buffer = workspace.attach_buffer("/some/file.txt").await.expect("failed to attach"); //! buffer.content(); // force-sync //! if let Some(mut update) = buffer.try_recv().await.unwrap() { //! println!(