Skip to content

Add FSEventStreamSetDispatchQueue, clippy fix #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fsevent-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repository = "https://github.com/octplane/fsevent-rust/tree/master/fsevent-sys"
edition = "2018"

[dependencies]
dispatch2 = { version = "0.2.0", default-features = false, features = ["alloc"] }
libc = "0.2.68"

[package.metadata.docs.rs]
Expand Down
2 changes: 1 addition & 1 deletion fsevent-sys/src/core_foundation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extern "C" {

pub unsafe fn str_path_to_cfstring_ref(source: &str, err: &mut CFErrorRef) -> CFStringRef {
let c_path = CString::new(source).unwrap();
let c_len = libc::strlen(c_path.as_ptr());
let c_len = c_path.as_bytes().len();
let mut url = CFURLCreateFromFileSystemRepresentation(
kCFAllocatorDefault,
c_path.as_ptr(),
Expand Down
5 changes: 3 additions & 2 deletions fsevent-sys/src/fsevent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::core_foundation::{
CFAllocatorReleaseCallBack, CFAllocatorRetainCallBack, CFArrayRef, CFIndex, CFRunLoopRef,
CFStringRef, CFTimeInterval,
};
use dispatch2::ffi::dispatch_queue_t;
use libc::dev_t;
use std::os::raw::{c_uint, c_void};

Expand Down Expand Up @@ -74,7 +75,7 @@ pub struct FSEventStreamContext {

// https://developer.apple.com/documentation/coreservices/file_system_events
#[link(name = "CoreServices", kind = "framework")]
extern "C" {
unsafe extern "C" {
pub fn FSEventStreamCopyDescription(stream_ref: ConstFSEventStreamRef) -> CFStringRef;
pub fn FSEventStreamCopyPathsBeingWatched(streamRef: ConstFSEventStreamRef) -> CFArrayRef;
pub fn FSEventStreamCreate(
Expand Down Expand Up @@ -109,7 +110,7 @@ extern "C" {
run_loop: CFRunLoopRef,
run_loop_mode: CFStringRef,
);
// pub fn FSEventStreamSetDispatchQueue(streamRef: FSEventStreamRef, q: DispatchQueue);
pub fn FSEventStreamSetDispatchQueue(stream_ref: FSEventStreamRef, q: dispatch_queue_t);
pub fn FSEventStreamSetExclusionPaths(
stream_ref: FSEventStreamRef,
paths_to_exclude: CFArrayRef,
Expand Down
1 change: 0 additions & 1 deletion fsevent-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg(target_os = "macos")]
#![cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))]

pub mod core_foundation;
mod fsevent;
Expand Down