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 upCFString refactor / cleanup #76
Conversation
|
r? @pcwalton |
|
Isn't |
|
As far as I know, |
https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFStringRef/ |
|
Yes, but as far as I understand, this function is only used to verify that all characters in the string have been written. All functions actually accessing the string data always specify |
|
Oh I see. Could we use |
|
We probably could, but from reading the documentation I think |
|
Oh right. |
Make CTFontDescriptor::family_name() actually return the family name It was incorrectly returning the display name, which already has a separate function. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/76) <!-- Reviewable:end -->
|
@TimNN Is there any reason not to merge these changes besides maintainers being unresponsive? |
|
So I thought that there had been a rather large change to the If there's still interest in getting this merged, I'd be happy to rebase the PR or let someone else take over. |
|
I'm in favour of merging a rebased version :) |
|
Opened #220 with the rebase. |
CFString refactor / cleanup This pull request: - removes two unnecessary casts (from `CFIndex` to `usize` and back again) - extracts the to rust string conversion: instead of doing it on-the-fly in the `Display` implementation (and thus only supporting the indirect `ToString` way to get a rust string from a `CFString`, which _always_ allocates) this implements `From<&CFString> for Cow<str>` allowing everyone the possibility of avoiding an allocation if the `CFString` is already formatted in UTF-8. Rebase of #76 (note to self: next time, re-open first, then push). cc @jdm <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/220) <!-- Reviewable:end -->
TimNN commentedDec 18, 2015
This pull request:
CFIndextousizeand back again)Displayimplementation (and thus only supporting the indirectToStringway to get a rust string from aCFString, which always allocates) this implementsFrom<&CFString> for Cow<str>allowing everyone the possibility of avoiding an allocation if theCFStringis already formatted in UTF-8.