chore: pub(crate) for cursor controller too

This commit is contained in:
əlemi 2024-08-15 19:31:34 +02:00
parent e732e6a938
commit 2f955ecef4
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 11 additions and 26 deletions

View file

@ -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]

View file

@ -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,