mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 23:34:49 +01:00
fix: controller with 1 generic
This commit is contained in:
parent
e85833a40f
commit
05a4c88967
3 changed files with 1 additions and 8 deletions
|
@ -25,14 +25,11 @@ pub(crate) trait ControllerWorker<T : Sized + Send + Sync> {
|
||||||
/// * if async is not feasible a [Controller::poll]/[Controller::try_recv] approach is possible
|
/// * if async is not feasible a [Controller::poll]/[Controller::try_recv] approach is possible
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
pub trait Controller<T : Sized + Send + Sync> : Sized + Send + Sync {
|
pub trait Controller<T : Sized + Send + Sync> : Sized + Send + Sync {
|
||||||
/// type of upstream values, used in [Self::send]
|
|
||||||
type Input;
|
|
||||||
|
|
||||||
/// enqueue a new value to be sent to all other users
|
/// enqueue a new value to be sent to all other users
|
||||||
///
|
///
|
||||||
/// success or failure of this function does not imply validity of sent operation,
|
/// success or failure of this function does not imply validity of sent operation,
|
||||||
/// because it's integrated asynchronously on the background worker
|
/// because it's integrated asynchronously on the background worker
|
||||||
fn send(&self, x: Self::Input) -> Result<()>;
|
fn send(&self, x: T) -> Result<()>;
|
||||||
|
|
||||||
/// get next value from other users, blocking until one is available
|
/// get next value from other users, blocking until one is available
|
||||||
///
|
///
|
||||||
|
|
|
@ -77,8 +77,6 @@ impl Drop for StopOnDrop {
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Controller<TextChange> for BufferController {
|
impl Controller<TextChange> for BufferController {
|
||||||
type Input = TextChange;
|
|
||||||
|
|
||||||
/// block until a text change is available
|
/// block until a text change is available
|
||||||
/// this returns immediately if one is already available
|
/// this returns immediately if one is already available
|
||||||
async fn poll(&self) -> crate::Result<()> {
|
async fn poll(&self) -> crate::Result<()> {
|
||||||
|
|
|
@ -67,8 +67,6 @@ impl CursorController {
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Controller<Cursor> for CursorController {
|
impl Controller<Cursor> for CursorController {
|
||||||
type Input = Cursor;
|
|
||||||
|
|
||||||
/// enqueue a cursor event to be broadcast to current workspace
|
/// enqueue a cursor event to be broadcast to current workspace
|
||||||
/// will automatically invert cursor start/end if they are inverted
|
/// will automatically invert cursor start/end if they are inverted
|
||||||
fn send(&self, mut cursor: Cursor) -> crate::Result<()> {
|
fn send(&self, mut cursor: Cursor) -> crate::Result<()> {
|
||||||
|
|
Loading…
Reference in a new issue