pub struct WatchHandle { /* private fields */ }Expand description
A live watcher subscription. Dropping it stops receiving events.
Obtained from WorkspaceWatcher::watch. The adapter that implements
WorkspaceWatcher maps platform-level file-system events into
WorkspaceChange and publishes them to the application event bus.
Implementations§
Source§impl WatchHandle
impl WatchHandle
Sourcepub fn new(receiver: Receiver<WorkspaceChange>) -> Self
pub fn new(receiver: Receiver<WorkspaceChange>) -> Self
Wrap a broadcast receiver. Used by WorkspaceWatcher implementations.
Public so an adapter crate can construct the handle it returns; the shape is otherwise opaque on purpose.
Sourcepub async fn recv(&mut self) -> Result<WorkspaceChange, RecvError>
pub async fn recv(&mut self) -> Result<WorkspaceChange, RecvError>
Wait for the next change event.
Sourcepub fn try_recv(&mut self) -> Result<WorkspaceChange, TryRecvError>
pub fn try_recv(&mut self) -> Result<WorkspaceChange, TryRecvError>
Returns Some if a change is already waiting, None otherwise.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WatchHandle
impl RefUnwindSafe for WatchHandle
impl Send for WatchHandle
impl Sync for WatchHandle
impl Unpin for WatchHandle
impl UnsafeUnpin for WatchHandle
impl UnwindSafe for WatchHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more