Skip to content

Commit 9316744

Browse files
committed
Use core-foundation crate
1 parent 5031204 commit 9316744

File tree

9 files changed

+117
-377
lines changed

9 files changed

+117
-377
lines changed

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ edition = "2018"
1010

1111
[dependencies]
1212
bitflags = "1"
13-
fsevent-sys = "4.0.0"
14-
# fsevent-sys = { path = "fsevent-sys" }
13+
# fsevent-sys = "5.0.0"
14+
fsevent-sys = { path = "fsevent-sys" }
15+
core-foundation = "0.9.4"
1516

1617
[dev-dependencies]
1718
tempfile = "3"

examples/fsevent-async-demo.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
extern crate fsevent;
1+
use std::{sync::mpsc::channel, thread};
22

3-
use std::sync::mpsc::channel;
4-
use std::thread;
5-
6-
#[cfg(not(target_os="macos"))]
3+
#[cfg(not(target_os = "macos"))]
74
fn main() {}
85

9-
#[cfg(target_os="macos")]
6+
#[cfg(target_os = "macos")]
107
fn main() {
118
let (sender, receiver) = channel();
129

@@ -24,7 +21,7 @@ fn main() {
2421
Err(e) => match e {
2522
std::sync::mpsc::RecvTimeoutError::Disconnected => break,
2623
_ => {} // This is the case where nothing entered the channel buffer (no file mods).
27-
}
24+
},
2825
}
2926
}
3027

examples/fsevent-demo.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
extern crate fsevent;
2-
use std::sync::mpsc::channel;
3-
use std::thread;
1+
use std::{sync::mpsc::channel, thread};
42

5-
#[cfg(not(target_os="macos"))]
3+
#[cfg(not(target_os = "macos"))]
64
fn main() {}
75

8-
#[cfg(target_os="macos")]
6+
#[cfg(target_os = "macos")]
97
fn main() {
108
let (sender, receiver) = channel();
119

fsevent-sys/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fsevent-sys"
3-
version = "4.1.0"
3+
version = "5.0.0"
44
authors = ["Pierre Baillet <[email protected]>"]
55
description = "Rust bindings to the fsevent macOS API for file changes notifications"
66
license = "MIT"
@@ -9,7 +9,10 @@ edition = "2018"
99

1010
[dependencies]
1111
dispatch2 = { version = "0.2.0", default-features = false, features = ["alloc"] }
12-
libc = "0.2.68"
12+
core-foundation = "0.9.2"
1313

1414
[package.metadata.docs.rs]
15-
targets = ["x86_64-apple-darwin"]
15+
targets = [
16+
"x86_64-apple-darwin",
17+
"aarch64-apple-darwin",
18+
]

fsevent-sys/src/core_foundation.rs

Lines changed: 0 additions & 230 deletions
This file was deleted.

fsevent-sys/src/fsevent.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
#![allow(non_upper_case_globals, non_camel_case_types)]
22

3-
use crate::core_foundation::{
4-
Boolean, CFAbsoluteTime, CFAllocatorCopyDescriptionCallBack, CFAllocatorRef,
5-
CFAllocatorReleaseCallBack, CFAllocatorRetainCallBack, CFArrayRef, CFIndex, CFRunLoopRef,
6-
CFStringRef, CFTimeInterval,
3+
use core_foundation::{
4+
array::{CFArrayRef, CFIndex},
5+
base::{
6+
Boolean, CFAllocatorCopyDescriptionCallBack, CFAllocatorReleaseCallBack,
7+
CFAllocatorRetainCallBack,
8+
},
9+
date::{CFAbsoluteTime, CFTimeInterval},
10+
mach_port::CFAllocatorRef,
11+
runloop::CFRunLoopRef,
12+
string::CFStringRef,
713
};
814
use dispatch2::ffi::dispatch_queue_t;
9-
use libc::dev_t;
10-
use std::os::raw::{c_uint, c_void};
15+
use std::os::{
16+
raw::{c_uint, c_void},
17+
unix::raw::dev_t,
18+
};
1119

1220
pub type FSEventStreamRef = *mut c_void;
1321
pub type ConstFSEventStreamRef = *const c_void;

fsevent-sys/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#![cfg(target_os = "macos")]
22

3-
pub mod core_foundation;
43
mod fsevent;
5-
64
pub use fsevent::*;

0 commit comments

Comments
 (0)