Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "toll-free bridging" between Objective-C and CoreFoundation types #693

Open
madsmtm opened this issue Jan 9, 2025 · 0 comments
Open
Labels
A-framework Affects the framework crates and the translator for them enhancement New feature or request

Comments

@madsmtm
Copy link
Owner

madsmtm commented Jan 9, 2025

Certain CF types are toll-free bridged to Objective-C types.

We should support that, it'll probably be enough to just add AsRef implementations, as we have a blanked impl<T: AsRef<U>> From<&T> for Retained<U>.

This won't be perfectly efficient, it will incur an extra retain/release, but a direct conversion like From<CFRetained<CFString>> for Retained<NSString> probably won't be doable due to the orphan rule.

I guess we could add something like CFRetained::into_objc / CFRetained::from_objc too?

@madsmtm madsmtm added enhancement New feature or request A-framework Affects the framework crates and the translator for them labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant