Commit Graph

29 Commits

Author SHA1 Message Date
Patrick Walton dc1184ebe2 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.
2013-11-15 09:46:49 +09:00
Simon Sapin 95f2f30981 Upgrade to rustc 0.8-pre (0ac3e02 2013-08-30 05:45:45 -0700) 2013-09-02 17:13:27 +01:00
Brian Anderson 9755a007a0 Update for language changes 2013-08-29 15:33:30 -07:00
Jack Moffitt 22e29ddc68 Rename iterators. 2013-08-16 11:02:21 -06:00
Jack Moffitt f9954a903b Fix warnings. 2013-08-16 11:02:08 -06:00
Jack Moffitt 16e61df6d1 Fix test failures. 2013-08-16 11:01:52 -06:00
Keegan McAllister 839fc639b4 Rewrite CFArray::each as an external iterator 2013-08-15 21:19:10 -07:00
Jack Moffitt cb48972c1d Upgrade to latest rust. 2013-08-15 18:45:17 -06:00
Brian Anderson ea8d2bd026 Update for language changes 2013-06-25 19:45:15 -07:00
Jack Moffitt 34970b962a Update for new for protocol. 2013-05-15 19:09:12 -06:00
Patrick Walton 92396f600e Fix tests 2013-05-02 18:32:33 -07:00
Patrick Walton 79afdda83a Update for language changes 2013-05-02 16:36:09 -07:00
Brian Anderson a8ebe76090 Add license headers 2013-04-04 19:01:35 -07:00
Jack Moffitt b997a59893 Remove unused imports. 2013-04-03 23:46:57 -06:00
Jack Moffitt d1903d4150 More 0.6 changes. 2013-03-28 09:24:28 -06:00
Jack Moffitt e9c5ee5c26 Change fail_unless! to assert!. 2013-03-26 16:44:16 -06:00
Jack Moffitt c8dd3d2096 Specify types on cast::transmute calls. 2013-03-26 16:17:54 -06:00
Jack Moffitt 648088bad4 Upgraded to Rust 0.6 syntax.
- removed pub from `pub impl A for B`
- replaced `const` with `static`
- implemented `Drop` and `Index` traits
- removed `pure` and `static` function keywords
- removed `DVec`
- added `self` parameters to methods
2013-03-26 16:17:39 -06:00
Patrick Walton 1152347b9f Update for language changes 2013-02-19 17:50:56 -08:00
Patrick Walton 01d8691bdf Update for language changes 2013-02-07 18:00:03 -08:00
Brian Anderson 990b275101 Rust upgrade 2013-01-30 14:33:26 -08:00
Brian J. Burg 04c0856f7d Implement AbstractCFType::type_id(). Switch to use CFTypeRef::downcast(). 2012-11-16 14:29:57 -08:00
Brian J. Burg 6bac6b0601 Fix CFArray test. 2012-11-16 12:07:31 -08:00
Brian J. Burg 8af8ef0d6d Rewrite the Core Foundation wrapper system. 2012-11-16 11:03:26 -08:00
Patrick Walton 93ac0efc6b Retain elements when iterating over an array 2012-11-15 20:45:18 -08:00
Brian J. Burg d316f05c00 Add wrapped and ref versions of CFArray.each/eachi(), and fix test. 2012-11-05 11:50:34 -08:00
Brian J. Burg fde0ba88ec Change AbstractCFType::as_type_ref() to use get_ref(), and add AbstractCFTypeRef::as_CFTypeRef(). 2012-11-02 18:41:33 -07:00
Brian J. Burg b3354191be Add CFSet, miscellaneous things, and clean up base.rs. 2012-11-02 16:21:01 -07:00
Brian J. Burg 13a2ef813a Rework base CF bindings, and add simple bindings for CFArray, CFURL, CFData. 2012-11-01 19:41:35 -07:00