Crates.io | fsevent-stream |
lib.rs | fsevent-stream |
version | 0.2.3 |
source | src |
created_at | 2021-12-04 16:49:14.595878 |
updated_at | 2022-01-09 15:41:18.534982 |
description | Stream-based FSEvent API bindings. |
homepage | |
repository | https://github.com/PhotonQuantum/fsevent-stream |
max_upload_size | |
id | 492287 |
size | 70,131 |
Stream-based FSEvents
API bindings.
kFSEventStreamCreateFlagUseExtendedData
.use std::path::Path;
use std::time::Duration;
use fsevent_stream::ffi::{
kFSEventStreamCreateFlagFileEvents, kFSEventStreamCreateFlagNoDefer,
kFSEventStreamCreateFlagUseCFTypes, kFSEventStreamCreateFlagUseExtendedData,
kFSEventStreamEventIdSinceNow,
};
use fsevent_stream::stream::create_event_stream;
use futures_util::StreamExt;
let (stream, handler) = create_event_stream(
[Path::new(".")],
kFSEventStreamEventIdSinceNow,
Duration::ZERO,
kFSEventStreamCreateFlagNoDefer
| kFSEventStreamCreateFlagFileEvents
| kFSEventStreamCreateFlagUseExtendedData
| kFSEventStreamCreateFlagUseCFTypes,
)
.expect("stream to be created");
let mut stream = stream.into_flatten();
while let Some(event) = stream.next().await {
println!(
"[{}] path: {:?}({}), flags: {} ({:x})",
event.id,
event.path,
event.inode.unwrap_or(-1),
event.flags,
event.raw_flags
);
}
Both tokio
and async-std
are supported
via feature flags.
tokio
support is enabled by default. To enable async-std
support, disable default features and enable async-std
feature.
Some code in this project is adapted from the following projects:
This project is licensed under MIT License.