pub struct WatchDirectory { /* private fields */ }Expand description
An owned, marshalable parameter set for FindFirstChangeNotificationW.
§Example
use windows_namespace_request_sys::prepare;
use windows_namespace_request_sys::watch::{NotifyFilter, WatchDirectory};
use wtf_string::Wtf16String;
let directory = std::env::temp_dir();
let text = directory.to_str().expect("the temporary directory is valid UTF-8");
let request = WatchDirectory::new(prepare(&Wtf16String::from(text))?)
.with_subtree(true)
.with_filter(NotifyFilter::FILE_NAME | NotifyFilter::DIR_NAME);
let notification = request.perform()?;
// The handle is closed with FindCloseChangeNotification, which the type
// remembers on the caller's behalf.
drop(notification);Implementations§
Source§impl WatchDirectory
impl WatchDirectory
Sourcepub fn new(path: PreparedPath) -> Self
pub fn new(path: PreparedPath) -> Self
Begins a request to watch path.
The watch starts non-recursive and watching for nothing; both are set explicitly, as everywhere else in this crate.
Sourcepub fn with_subtree(self, subtree: bool) -> Self
pub fn with_subtree(self, subtree: bool) -> Self
Sets bWatchSubtree.
Sourcepub fn with_filter(self, filter: NotifyFilter) -> Self
pub fn with_filter(self, filter: NotifyFilter) -> Self
Sets dwNotifyFilter.
Sourcepub fn path(&self) -> &PreparedPath
pub fn path(&self) -> &PreparedPath
The prepared path this request will watch.
Sourcepub fn filter(&self) -> NotifyFilter
pub fn filter(&self) -> NotifyFilter
The change classes the watch reports.
Sourcepub fn perform(&self) -> Outcome<ChangeNotification>
pub fn perform(&self) -> Outcome<ChangeNotification>
Trait Implementations§
Source§impl Clone for WatchDirectory
impl Clone for WatchDirectory
Source§fn clone(&self) -> WatchDirectory
fn clone(&self) -> WatchDirectory
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WatchDirectory
impl Debug for WatchDirectory
Source§impl Request for WatchDirectory
impl Request for WatchDirectory
Source§type Error = Win32Error
type Error = Win32Error
How performing it can fail. Read more
Source§type Output = ChangeNotification
type Output = ChangeNotification
What performing the request produces.
Auto Trait Implementations§
impl Freeze for WatchDirectory
impl RefUnwindSafe for WatchDirectory
impl Send for WatchDirectory
impl Sync for WatchDirectory
impl Unpin for WatchDirectory
impl UnsafeUnpin for WatchDirectory
impl UnwindSafe for WatchDirectory
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