Merge pull request #20 from hexedtech/fix/doc-tests

fix: mark tests as no_run: they require net access
This commit is contained in:
əlemi 2024-09-25 17:12:48 +02:00 committed by GitHub
commit 8249888d5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 13 deletions

View file

@ -20,7 +20,7 @@
/// To delete a the fourth character we should send a. /// To delete a the fourth character we should send a.
/// `TextChange { start: 3, end: 4, content: "".into(), hash: None }` /// `TextChange { start: 3, end: 4, content: "".into(), hash: None }`
/// ///
/// ```rust /// ```
/// let change = codemp::api::TextChange { /// let change = codemp::api::TextChange {
/// start: 6, end: 11, /// start: 6, end: 11,
/// content: "mom".to_string(), hash: None /// content: "mom".to_string(), hash: None

View file

@ -18,8 +18,8 @@
//! The main entrypoint is [`Client::connect`], which establishes an authenticated connection with //! The main entrypoint is [`Client::connect`], which establishes an authenticated connection with
//! 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.
//! //!
//! ```rust //! ```no_run
//! # async fn main_fn() { //! # async {
//! let client = codemp::Client::connect( //! let client = codemp::Client::connect(
//! codemp::api::Config::new( //! codemp::api::Config::new(
//! "mail@example.net", //! "mail@example.net",
@ -28,25 +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`].
//! //!
//! ```rust, run //! ```no_run
//! # async fn main_fn() { //! # async {
//! # 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.
//! //!
//! ```rust //! ```no_run
//! # async fn main_fn() { //! # async {
//! # 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();
@ -54,15 +54,15 @@
//! 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
//! eventual consistency. Each [`api::TextChange`] is translated in a network counterpart that is //! eventual consistency. Each [`api::TextChange`] is translated in a network counterpart that is
//! guaranteed to converge. //! guaranteed to converge.
//! //!
//! ```rust //! ```no_run
//! # async fn main_fn() { //! # async {
//! # 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();
@ -72,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