Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upRevamp and modernize the Core Foundation APIs. #23
Conversation
|
Oops, sorry, pushed this onto the wrong branch. I'll remove the branch if and when this gets merged. |
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.
This comment has been minimized.
This comment has been minimized.
|
r+ |
metajack
added a commit
that referenced
this pull request
Nov 15, 2013
Revamp and modernize the Core Foundation APIs.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
pcwalton commentedNov 2, 2013
This change redoes the way Core Foundation works to make the API
smaller, safer, and easier to use. In particular:
structs, not on making atype alias of
CFWrapper.CFArrayandCFDictionarywereremoved as not pulling their weight (IMHO).
wrap_ownedandwrap_shared) are now markedunsafe.wrap_ownedhas been renamed towrap_under_create_ruleandwrap_sharedhas been renamed towrap_under_get_rule, to matchApple's documentation.
borrow_refand friends have been simplified intoas_concrete_TypeRef()andas_TypeRef().Core Foundation objects. The old code tried not to assume that,
but ended up assuming that anyway in a couple of places.
CFStrings can be converted from Rust types with theFromStrtrait.
CFNumbers can be converted to and from Rust types withToPrimitiveandFromPrimitive, eliminating the duplication offunctionality inside this module.
r? @metajack