Skip to content
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

Modernization and cleanup #69

Merged
merged 8 commits into from Sep 5, 2015
Merged
Prev

Update based on review

  • Loading branch information
sfackler committed Sep 1, 2015
commit 9621fbf4fe992b644c52663f10f5581601015f6a
@@ -77,7 +77,7 @@ impl_TCFType!(CFArray, CFArrayRef, CFArrayGetTypeID);

impl CFArray {
/// Creates a new `CFArray` with the given elements, which must be `CFType` objects.
pub fn from_CFTypes<R, T: TCFType<R>>(elems: &[T]) -> CFArray {
pub fn from_CFTypes<R, T>(elems: &[T]) -> CFArray where T: TCFType<R> {
unsafe {
let elems: Vec<CFTypeRef> = elems.iter().map(|elem| elem.as_CFTypeRef()).collect();
let array_ref = CFArrayCreate(kCFAllocatorDefault,
@@ -53,7 +53,7 @@ impl_TCFType!(CFSet, CFSetRef, CFSetGetTypeID);

impl CFSet {
/// Creates a new set from a list of `CFType` instances.
pub fn from_slice<R, T: TCFType<R>>(elems: &[T]) -> CFSet {
pub fn from_slice<R, T>(elems: &[T]) -> CFSet where T: TCFType<R> {
unsafe {
let elems: Vec<CFTypeRef> = elems.iter().map(|elem| elem.as_CFTypeRef()).collect();
let set_ref = CFSetCreate(kCFAllocatorDefault,
@@ -229,9 +229,7 @@ impl_TCFType!(CFString, CFStringRef, CFStringGetTypeID);
impl FromStr for CFString {
type Err = ();

/// # Deprecated
///
/// Use CFString::new instead.
/// See also CFString::new for a variant of this which does not return a Result
#[inline]
fn from_str(string: &str) -> Result<CFString, ()> {
Ok(CFString::new(string))
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.