Struct fswatch_sys::FswSession
[−]
[src]
pub struct FswSession { /* fields omitted */ }
A session in fswatch, revolving around a handle.
Calling new
creates a new handle, initiating a new session. Options can be set before calling
start_monitor
.
Methods
impl FswSession
[src]
fn new(monitor_type: FswMonitorType) -> Result<FswSession, FswError>
Create a new session and handle, using the given monitor type.
fn default() -> Result<FswSession, FswError>
Create a new session and handle, usin gthe system default monitor type.
This is a convenience method for FswSession::new(FswMonitorType::SystemDefaultMonitorType)
.
fn builder() -> FswSessionBuilder
fn builder_paths<P>(paths: Vec<P>) -> FswSessionBuilder where P: AsRef<Path>
fn add_path<T: AsRef<Path>>(&self, path: T) -> Result<(), FswError>
Add a path to watch for this session.
fn add_property(&self, name: &str, value: &str) -> Result<(), FswError>
Add a custom property to this session.
fn set_allow_overflow(&self, allow_overflow: bool) -> Result<(), FswError>
Set whether to allow overflow for this session.
fn set_callback<F>(&self, callback: F) -> Result<(), FswError> where F: Fn(Vec<FswCEvent>) + 'static
Set the callback for this session.
The callback will receive a Vec<FswCEvent>
, which is a copy of the events given by fswatch.
Calling this multiple times will cause this session to use the last callback specified, but due to the limited functions in the C API, the previous callbacks will never be freed from memory, causing a memory leak.
fn set_latency(&self, latency: c_double) -> Result<(), FswError>
Set the latency for this session.
fn set_recursive(&self, recursive: bool) -> Result<(), FswError>
Set whether this session should be recursive.
fn set_directory_only(&self, directory_only: bool) -> Result<(), FswError>
Set whether this session should be directory only.
fn set_follow_symlinks(&self, follow_symlinks: bool) -> Result<(), FswError>
Set whether this session should follow symlinks.
fn add_event_type_filter(&self,
event_type: FswEventFlag)
-> Result<(), FswError>
event_type: FswEventFlag)
-> Result<(), FswError>
Add an event filter for the given event flag.
fn add_filter(&self, filter: FswCMonitorFilter) -> Result<(), FswError>
Add a filter.
fn start_monitor(&self) -> Result<(), FswError>
Start monitoring for this session.
Depending on the monitor you are using, this method may block.
fn destroy_session(&self) -> Result<(), FswError>
Destroy this session, freeing it from memory and invalidating its handle.
This is called automatically when the session goes out of scope.
Trait Implementations
impl Debug for FswSession
[src]
impl IntoIterator for FswSession
[src]
type Item = FswCEvent
The type of the elements being iterated over.
type IntoIter = FswSessionIterator
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more