mozilla-servo/rust-core-foundation — pull request #23 by pcwalton (2013-11-02 06:16:38+00:00)
Title: Revamp and modernize the Core Foundation APIs.

This change redoes the way Core Foundation works to make the API
smaller, safer, and easier to use. In particular:

* Deriving custom types is now based on `struct`s, not on making a
type alias of `CFWrapper`.

* The attempts at type safety for `CFArray` and `CFDictionary` were
removed as not pulling their weight (IMHO).

* Methods that are really unsafe (in particular `wrap_owned` and
`wrap_shared`) are now marked `unsafe`.

* `wrap_owned` has been renamed to `wrap_under_create_rule` and
`wrap_shared` has been renamed to `wrap_under_get_rule`, to match
Apple's documentation.

* `borrow_ref` and friends have been simplified into
`as_concrete_TypeRef()` and `as_TypeRef()`.

* Dictionaries, arrays, and sets now assume that their elements are
Core Foundation objects. The old code tried not to assume that,
but ended up assuming that anyway in a couple of places.

* `CFString`s can be converted from Rust types with the `FromStr`
trait. `CFNumber`s can be converted to and from Rust types with
`ToPrimitive` and `FromPrimitive`, eliminating the duplication of
functionality inside this module.

r? @metajack