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

Remove non-interior mutability from non-generic types #633

Merged
merged 5 commits into from
Jun 20, 2024

Conversation

madsmtm
Copy link
Owner

@madsmtm madsmtm commented Jun 20, 2024

Part of #563.

Remove non-interior mutability from the types NSString, NSAttributedString, NSData, and a few others. Remaining are only the generic types NSArray, NSSet, NSDictionary, NSEnumerator and so on, which will be handled by #587.

The move of NSString was facilitated by #628.

The changes to NSData might incur a performance cost if users decide to use the safe to_vec over the unsafe as_slice_unchecked, and the iteration methods are also less performant now.

Notes:

  • Send+Sync was removed from all of the above types, as they're now interior mutable.
  • The trait impls like std::io::Write that require &mut was changed to be implemented on &T instead of T. This could be further improved with different impls on Retained<T>.

@madsmtm madsmtm added enhancement New feature or request A-framework Affects the framework crates and the translator for them labels Jun 20, 2024
@madsmtm madsmtm added this to the objc2 v0.6 milestone Jun 20, 2024
@madsmtm madsmtm force-pushed the remove-generic-non-mut branch 4 times, most recently from 6cf4af7 to 713d6d2 Compare June 20, 2024 15:48
@madsmtm madsmtm force-pushed the remove-generic-non-mut branch from 713d6d2 to f7226f7 Compare June 20, 2024 15:50
@madsmtm madsmtm changed the title Removing non-interior mutability from non-generic types Remove non-interior mutability from non-generic types Jun 20, 2024
@madsmtm madsmtm merged commit 47abe0b into master Jun 20, 2024
19 checks passed
@madsmtm madsmtm deleted the remove-generic-non-mut branch June 20, 2024 15:56
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

Successfully merging this pull request may close these issues.

1 participant