mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 23:34:49 +01:00
chore: pub(crate) for cursor controller too
This commit is contained in:
parent
e732e6a938
commit
2f955ecef4
2 changed files with 11 additions and 26 deletions
|
@ -26,26 +26,11 @@ pub struct CursorController(pub(crate) Arc<CursorControllerInner>);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct CursorControllerInner {
|
pub(crate) struct CursorControllerInner {
|
||||||
op: mpsc::Sender<CursorPosition>,
|
pub(crate) op: mpsc::Sender<CursorPosition>,
|
||||||
last_op: Mutex<watch::Receiver<CursorEvent>>,
|
pub(crate) last_op: Mutex<watch::Receiver<CursorEvent>>,
|
||||||
stream: Mutex<broadcast::Receiver<CursorEvent>>,
|
pub(crate) stream: Mutex<broadcast::Receiver<CursorEvent>>,
|
||||||
stop: mpsc::UnboundedSender<()>,
|
pub(crate) callback: watch::Sender<Option<ControllerCallback>>,
|
||||||
}
|
pub(crate) stop: mpsc::UnboundedSender<()>,
|
||||||
|
|
||||||
impl CursorControllerInner {
|
|
||||||
pub(crate) fn new(
|
|
||||||
op: mpsc::Sender<CursorPosition>,
|
|
||||||
last_op: Mutex<watch::Receiver<CursorEvent>>,
|
|
||||||
stream: Mutex<broadcast::Receiver<CursorEvent>>,
|
|
||||||
stop: mpsc::UnboundedSender<()>,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
|
||||||
op,
|
|
||||||
last_op,
|
|
||||||
stream,
|
|
||||||
stop,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
|
|
|
@ -22,12 +22,12 @@ impl Default for CursorWorker {
|
||||||
let (cur_tx, _cur_rx) = broadcast::channel(64);
|
let (cur_tx, _cur_rx) = broadcast::channel(64);
|
||||||
let (end_tx, end_rx) = mpsc::unbounded_channel();
|
let (end_tx, end_rx) = mpsc::unbounded_channel();
|
||||||
let (change_tx, change_rx) = watch::channel(CursorEvent::default());
|
let (change_tx, change_rx) = watch::channel(CursorEvent::default());
|
||||||
let controller = CursorControllerInner::new(
|
let controller = CursorControllerInner {
|
||||||
op_tx,
|
op: op_tx,
|
||||||
Mutex::new(change_rx),
|
last_op: Mutex::new(change_rx),
|
||||||
Mutex::new(cur_tx.subscribe()),
|
stream: Mutex::new(cur_tx.subscribe()),
|
||||||
end_tx
|
stop: end_tx,
|
||||||
);
|
};
|
||||||
Self {
|
Self {
|
||||||
op: op_rx,
|
op: op_rx,
|
||||||
changed: change_tx,
|
changed: change_tx,
|
||||||
|
|
Loading…
Reference in a new issue