mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 07:14:50 +01:00
docs: better select_buffer text
This commit is contained in:
parent
7ad1da0f27
commit
2f0875a38f
1 changed files with 8 additions and 6 deletions
14
src/tools.rs
14
src/tools.rs
|
@ -2,14 +2,16 @@ use crate::{Error, api::Controller};
|
|||
use std::sync::Arc;
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
/// invoke .poll() on all buffer controllers and wait, return name of first one ready
|
||||
/// invoke .poll() on all given buffer controllers and wait, returning the first one ready
|
||||
///
|
||||
/// this will spawn tasks for each buffer controller, each blocked in a poll() call. as soon as
|
||||
/// one finishes, all other tasks will be canceled and the name of ready controller will be
|
||||
/// returned. just do client.get_buffer(name).try_recv()
|
||||
/// this will spawn tasks blocked on .poll() for each buffer controller. as soon as
|
||||
/// one finishes, all other tasks will be canceled and the ready controller will be
|
||||
/// returned
|
||||
///
|
||||
/// this is not super efficient as of now but has room for improvement. using this API may
|
||||
/// provide significant improvements on editor-side
|
||||
/// if timeout is None, result will never be None, otherwise returns None if no buffer
|
||||
/// is ready before timeout expires
|
||||
///
|
||||
/// returns an error if all buffers returned errors while polling.
|
||||
pub async fn select_buffer(
|
||||
buffers: &[Arc<crate::buffer::Controller>],
|
||||
timeout: Option<std::time::Duration>,
|
||||
|
|
Loading…
Reference in a new issue