Fix the type of Arc::from_raw().
Previously we were mistakenly creating an `Arc<c_void>` instead of an
`Arc<T>`. This also changes the test to catch this problem.
Fix the definition of CFAllocatorContext
The function pointers can be null so should be wrapped in Option.
This struct was basically unusable before so I think we should
be fine making this change while only bumping the patch version.
I was unable to find any uses of it on github.
The function pointers can be null so should be wrapped in Option.
This struct was basically unusable before so I think we should
be fine making this change while only bumping the patch version.
I was unable to find any uses of it on github.
feat(CFNumber): change `CFNumberType` from static to const, to improve match expression ergonomics
this PR changes the `CFNumberType` values like `kCFNumberSInt64Type` from `static` to `const`.
That way it is possible to simplify match expressions like this:
before:
```rust
let type_id = unsafe { CFNumberGetType(value) };
match type_id {
si64 if si64 == kCFNumberSInt64Type => {},
si32 if si32 == kCFNumberSInt32Type => {},
_ => {},
}
```
after:
```rust
let type_id = unsafe { CFNumberGetType(value) };
match type_id {
kCFNumberSInt64Type => {},
kCFNumberSInt32Type => {},
_ => {},
}
```
Note: function call `CFNumberGetType(value)` is implemented in PR #411
add `CFNumberGetType` to determine specific number type
this PR adds support for `CFNumberGetType` that is needed if there is a `CFNumberRef` and it is not clear what sort of number it is.
Now it would be possible to do such a thing:
```rust
let type_id = unsafe { CFNumberGetType(value) };
match type_id {
si64 if si64 == kCFNumberSInt64Type => {},
si32 if si32 == kCFNumberSInt32Type => {},
_ => {},
}
```
feat(CFBoolean): add function `CFBooleanGetValue` to retrieve a value of a `CFBooleanRef`
This PR adds the function `CFBooleanGetValue` that gets the bool value by a `CFBooleanRef`
Separate out some new crates
This spits out core-graphics-types and cocoa-foundation with the goal of reducing the amount of interdependence between the crates with goal of reducing churn when things need to be updated.
cocoa-foundation should be enough for metal-rs and gfx-metal-backend.
Originally, I had wanted core-graphics-types to be enough for core-text but it's use of CGContext prevents that.
Make CGDataProvider::from_buffer more generic
This lets us use more types than just Vec<u8> and should avoid any
compatibility breaks. It also adds a test that ensures
the memory gets released.
Use wrap_under_get_rule where expected
I had initially thought I could skip a retain in these cases since
we can trivially track the lifetime of the reference, but I ran into
a segfault in a test that used the empty string, which I tracked
down to here.
I'm not totally sure what's actually going on under the hood, but I
do know that this fixes my crash and also that I was being overly
clever anyway.
I had initially thought I could skip a retain in these cases since
we can trivially track the lifetime of the reference, but I ran into
a segfault in a test that used the empty string, which I tracked
down to here.
I'm not totally sure what's actually going on under the hood, but I
do know that this fixes my crash and also that I was being overly
clever anyway.