Vendor dependencies

This commit is contained in:
2026-08-01 16:11:49 +03:00
parent 7f139a0241
commit 6b5e7f0f8b
29706 changed files with 9575646 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
use std::{fs::File, io, thread, time::Duration};
use inotify::{Inotify, StreamExt, WatchMask};
use tempfile::TempDir;
#[tokio::main]
async fn main() -> Result<(), io::Error> {
let inotify = Inotify::init().expect("Failed to initialize inotify");
let dir = TempDir::new()?;
inotify
.watches()
.add(dir.path(), WatchMask::CREATE | WatchMask::MODIFY)?;
thread::spawn::<_, Result<(), io::Error>>(move || loop {
File::create(dir.path().join("file"))?;
thread::sleep(Duration::from_millis(500));
});
let mut buffer = [0; 1024];
let mut stream = inotify.into_event_stream(&mut buffer)?;
while let Some(event_or_error) = stream.next().await {
println!("event: {:?}", event_or_error?);
}
Ok(())
}
+48
View File
@@ -0,0 +1,48 @@
use std::env;
use inotify::{EventMask, Inotify, WatchMask};
fn main() {
let mut inotify = Inotify::init().expect("Failed to initialize inotify");
let current_dir = env::current_dir().expect("Failed to determine current directory");
inotify
.watches()
.add(
current_dir,
WatchMask::MODIFY | WatchMask::CREATE | WatchMask::DELETE,
)
.expect("Failed to add inotify watch");
println!("Watching current directory for activity...");
let mut buffer = [0u8; 4096];
loop {
let events = inotify
.read_events_blocking(&mut buffer)
.expect("Failed to read inotify events");
for event in events {
if event.mask.contains(EventMask::CREATE) {
if event.mask.contains(EventMask::ISDIR) {
println!("Directory created: {:?}", event.name);
} else {
println!("File created: {:?}", event.name);
}
} else if event.mask.contains(EventMask::DELETE) {
if event.mask.contains(EventMask::ISDIR) {
println!("Directory deleted: {:?}", event.name);
} else {
println!("File deleted: {:?}", event.name);
}
} else if event.mask.contains(EventMask::MODIFY) {
if event.mask.contains(EventMask::ISDIR) {
println!("Directory modified: {:?}", event.name);
} else {
println!("File modified: {:?}", event.name);
}
}
}
}
}