mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-23 13:24:54 +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)]
|
||||
pub(crate) struct CursorControllerInner {
|
||||
op: mpsc::Sender<CursorPosition>,
|
||||
last_op: Mutex<watch::Receiver<CursorEvent>>,
|
||||
stream: Mutex<broadcast::Receiver<CursorEvent>>,
|
||||
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,
|
||||
}
|
||||
}
|
||||
pub(crate) op: mpsc::Sender<CursorPosition>,
|
||||
pub(crate) last_op: Mutex<watch::Receiver<CursorEvent>>,
|
||||
pub(crate) stream: Mutex<broadcast::Receiver<CursorEvent>>,
|
||||
pub(crate) callback: watch::Sender<Option<ControllerCallback>>,
|
||||
pub(crate) stop: mpsc::UnboundedSender<()>,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
|
|
@ -22,12 +22,12 @@ impl Default for CursorWorker {
|
|||
let (cur_tx, _cur_rx) = broadcast::channel(64);
|
||||
let (end_tx, end_rx) = mpsc::unbounded_channel();
|
||||
let (change_tx, change_rx) = watch::channel(CursorEvent::default());
|
||||
let controller = CursorControllerInner::new(
|
||||
op_tx,
|
||||
Mutex::new(change_rx),
|
||||
Mutex::new(cur_tx.subscribe()),
|
||||
end_tx
|
||||
);
|
||||
let controller = CursorControllerInner {
|
||||
op: op_tx,
|
||||
last_op: Mutex::new(change_rx),
|
||||
stream: Mutex::new(cur_tx.subscribe()),
|
||||
stop: end_tx,
|
||||
};
|
||||
Self {
|
||||
op: op_rx,
|
||||
changed: change_tx,
|
||||
|
|
Loading…
Reference in a new issue