diff --git a/cidre/src/cf/date.rs b/cidre/src/cf/date.rs index cbf0e795..172e6a6d 100644 --- a/cidre/src/cf/date.rs +++ b/cidre/src/cf/date.rs @@ -1,7 +1,7 @@ use crate::{arc, cf, define_cf_type}; -use std::ffi::{c_double, c_void}; +use std::ffi::c_void; -pub type TimeInterval = c_double; +pub type TimeInterval = std::ffi::c_double; pub type AbsTime = TimeInterval; /// The current absolute time. diff --git a/cidre/src/cf/url.rs b/cidre/src/cf/url.rs index b191dcd2..2396031b 100644 --- a/cidre/src/cf/url.rs +++ b/cidre/src/cf/url.rs @@ -5,6 +5,7 @@ use crate::{arc, cf, define_cf_type}; #[cfg(feature = "ns")] use crate::ns; +#[doc(alias = "CFURLPathStyle")] #[derive(Debug, PartialEq, Eq)] #[repr(isize)] pub enum PathStyle { @@ -80,7 +81,6 @@ impl Url { /// let url = cf::Url::from_str("http://google.com").unwrap(); /// /// let scheme = url.scheme().unwrap(); - /// /// ``` #[inline] pub fn from_str(str: &str) -> Option> { @@ -100,7 +100,6 @@ impl Url { /// let url = cf::Url::from_cf_string(&s1).unwrap(); /// /// assert!(url.can_be_decomposed()); - /// /// ``` #[inline] pub fn from_cf_string(str: &cf::String) -> Option> { @@ -121,16 +120,19 @@ impl Url { /// assert!(s1.equal(s2)); /// /// ``` + #[doc(alias = "CFURLGetString")] #[inline] pub fn cf_string(&self) -> &cf::String { unsafe { CFURLGetString(self) } } + #[doc(alias = "CFURLGetBaseURL")] #[inline] pub fn base_url(&self) -> Option<&Url> { unsafe { CFURLGetBaseURL(self) } } + #[doc(alias = "CFURLCanBeDecomposed")] #[inline] pub fn can_be_decomposed(&self) -> bool { unsafe { CFURLCanBeDecomposed(self) } @@ -157,7 +159,6 @@ impl Url { /// let url1 = cf::Url::from_str("https://localhost:3000").unwrap(); /// /// assert_eq!(3000, url1.port()); - /// let url2 = cf::Url::from_str("https://localhost").unwrap(); /// /// assert_eq!(-1, url2.port()); @@ -174,11 +175,18 @@ impl Url { pub fn as_ns(&self) -> &ns::Url { unsafe { std::mem::transmute(self) } } + + #[doc(alias = "CFURLCopyAbsoluteURL")] + #[inline] + pub fn abs_url(&self) -> Option> { + unsafe { CFURLCopyAbsoluteURL(self) } + } } #[link(name = "CoreFoundation", kind = "framework")] extern "C" { fn CFURLGetTypeID() -> cf::TypeId; + fn CFURLCreateWithBytes( allocator: Option<&cf::Allocator>, url_bytes: *const u8, @@ -186,6 +194,7 @@ extern "C" { encoding: cf::StringEncoding, base_url: Option<&Url>, ) -> Option>; + fn CFURLCreateWithString( allocator: Option<&cf::Allocator>, url_string: &cf::String, @@ -201,9 +210,8 @@ extern "C" { fn CFURLGetString(anURL: &Url) -> &cf::String; fn CFURLGetBaseURL(anURL: &Url) -> Option<&Url>; - fn CFURLCanBeDecomposed(anURL: &Url) -> bool; fn CFURLCopyScheme(anURL: &Url) -> Option>; - fn CFURLGetPortNumber(anURL: &Url) -> i32; + fn CFURLCopyAbsoluteURL(relativeURL: &Url) -> Option>; }