From df6498fe53dd4f25d9a0a102be7303f1ea6c3385 Mon Sep 17 00:00:00 2001 From: michaelwright235 Date: Wed, 31 May 2023 22:01:05 +0300 Subject: [PATCH] sys: filedescriptor: Add missing funcs & sorting Adds missing functions of CFFileDescriptor and sorts them in Apple docs order. --- core-foundation-sys/src/filedescriptor.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core-foundation-sys/src/filedescriptor.rs b/core-foundation-sys/src/filedescriptor.rs index 3f51d10..036d8d5 100644 --- a/core-foundation-sys/src/filedescriptor.rs +++ b/core-foundation-sys/src/filedescriptor.rs @@ -27,7 +27,7 @@ pub const kCFFileDescriptorWriteCallBack: CFOptionFlags = 1 << 1; pub type CFFileDescriptorCallBack = extern "C" fn (f: CFFileDescriptorRef, callBackTypes: CFOptionFlags, info: *mut c_void); #[repr(C)] -#[derive(Clone, Copy)] +#[derive(Debug, Clone, Copy)] pub struct CFFileDescriptorContext { pub version: CFIndex, pub info: *mut c_void, @@ -40,19 +40,25 @@ extern { /* * CFFileDescriptor.h */ - pub fn CFFileDescriptorGetTypeID() -> CFTypeID; + /* Creating a CFFileDescriptor */ pub fn CFFileDescriptorCreate(allocator: CFAllocatorRef, fd: CFFileDescriptorNativeDescriptor, closeOnInvalidate: Boolean, callout: CFFileDescriptorCallBack, context: *const CFFileDescriptorContext) -> CFFileDescriptorRef; + /* Getting Information About a File Descriptor */ pub fn CFFileDescriptorGetNativeDescriptor(f: CFFileDescriptorRef) -> CFFileDescriptorNativeDescriptor; - + pub fn CFFileDescriptorIsValid(f: CFFileDescriptorRef) -> Boolean; pub fn CFFileDescriptorGetContext(f: CFFileDescriptorRef, context: *mut CFFileDescriptorContext); + /* Invalidating a File Descriptor */ + pub fn CFFileDescriptorInvalidate(f: CFFileDescriptorRef); + + /* Managing Callbacks */ pub fn CFFileDescriptorEnableCallBacks(f: CFFileDescriptorRef, callBackTypes: CFOptionFlags); pub fn CFFileDescriptorDisableCallBacks(f: CFFileDescriptorRef, callBackTypes: CFOptionFlags); - pub fn CFFileDescriptorInvalidate(f: CFFileDescriptorRef); - pub fn CFFileDescriptorIsValid(f: CFFileDescriptorRef) -> Boolean; - + /* Creating a Run Loop Source */ pub fn CFFileDescriptorCreateRunLoopSource(allocator: CFAllocatorRef, f: CFFileDescriptorRef, order: CFIndex) -> CFRunLoopSourceRef; + + /* Getting the CFFileDescriptor Type ID */ + pub fn CFFileDescriptorGetTypeID() -> CFTypeID; }