feat: added some gifs, explained async_trait fn

This commit is contained in:
əlemi 2023-08-20 04:00:52 +02:00
parent bb10367b08
commit 464d58f0ee
3 changed files with 12 additions and 2 deletions

View file

@ -1,4 +1,6 @@
//! ### buffer //! ### buffer
//!
//! ![demo gif of early buffer sync in action](https://cdn.alemi.dev/codemp/demo-vscode.gif)
//! //!
//! a buffer is a container fo text edited by users. //! a buffer is a container fo text edited by users.
//! this module contains buffer-related operations and helpers to create Operation Sequences //! this module contains buffer-related operations and helpers to create Operation Sequences

View file

@ -1,4 +1,6 @@
//! ### cursor //! ### cursor
//!
//! ![demo gif of early cursor sync in action](https://cdn.alemi.dev/codemp/demo-nvim.gif)
//! //!
//! each user holds a cursor, which consists of multiple highlighted region //! each user holds a cursor, which consists of multiple highlighted region
//! on a specific buffer //! on a specific buffer

View file

@ -23,11 +23,11 @@
//! To generate Operation Sequences use helper methods from the trait [buffer::OperationFactory]. //! To generate Operation Sequences use helper methods from the trait [buffer::OperationFactory].
//! //!
//! ## Features //! ## Features
//! * `proto` : include GRCP protocol definitions under [proto] (default) //! * `proto` : include GRCP protocol definitions under [proto] (default enabled)
//! * `global`: provide a lazy_static global INSTANCE in [instance::global] //! * `global`: provide a lazy_static global INSTANCE in [instance::global]
//! * `sync` : wraps the [instance::a_sync::Instance] holder into a sync variant: [instance::sync::Instance] //! * `sync` : wraps the [instance::a_sync::Instance] holder into a sync variant: [instance::sync::Instance]
//! //!
//! ## Example //! ## Examples
//! library can be used both sync and async depending on wether the `sync` feature flag has been //! library can be used both sync and async depending on wether the `sync` feature flag has been
//! enabled. a global `INSTANCE` static reference can also be made available with the `global` //! enabled. a global `INSTANCE` static reference can also be made available with the `global`
//! flag. //! flag.
@ -160,6 +160,12 @@ pub trait Controller<T : Sized + Send + Sync> : Sized + Send + Sync {
fn send(&self, x: Self::Input) -> Result<()>; fn send(&self, x: Self::Input) -> Result<()>;
/// get next value from stream, blocking until one is available /// get next value from stream, blocking until one is available
///
/// this is just an async trait function wrapped by `async_trait`:
///
/// ```
/// async fn recv(&self) -> codemp::Result<T>;
/// ```
async fn recv(&self) -> Result<T>; async fn recv(&self) -> Result<T>;
/// sync variant of [Self::recv], blocking invoking thread /// sync variant of [Self::recv], blocking invoking thread