fn make_cfstring(s: &str) -> Option<CFStringRef> {
    unsafe {
        let allocator = CFAllocatorGetDefault();
        let c_str = CString::new(s).ok()?;
        let cfstring_ref =
            CFStringCreateWithCString(allocator, c_str.as_ptr(), kCFStringEncodingUTF8);

        if cfstring_ref.is_null() {
            return None;
        }

        Some(cfstring_ref)
    }
}
/// Build a CFStringRef out of a &str ref.
Build a CFStringRef out of a &str ref.
Build a CFStringRef out of a &str ref .
fn make_cfstring(s: &str) -> Option<CFStringRef> {
    unsafe {
        let allocator = CFAllocatorGetDefault();
        let c_str = CString::new(s).ok()?;
        let cfstring_ref =
            CFStringCreateWithCString(allocator, c_str.as_ptr(), kCFStringEncodingUTF8);
        if cfstring_ref.is_null() {
            return None;
        }
        Some(cfstring_ref)
    }
}
fn make_cfstring ( s : & str ) -> Option < CFStringRef > { unsafe { let allocator = CFAllocatorGetDefault ( ) ; let c_str = CString :: new ( s ) . ok ( ) ? ; let cfstring_ref = CFStringCreateWithCString ( allocator , c_str . as_ptr ( ) , kCFStringEncodingUTF8 ) ; if cfstring_ref . is_null ( ) { return None ; } Some ( cfstring_ref ) } }
Build a CFStringRef out of a &str ref.
Build a CFStringRef out of a &str ref .
s
&str
s
&str