-
Notifications
You must be signed in to change notification settings - Fork 44
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
Fix ownership in objc2-foundation
#29
Labels
Comments
trait INSArray: INSObject {
type Item: INSObject; // ??
type Enumerator = NSEnumerator; // ???
fn iter(&'a self) -> Self::Enumerator<'a, Self, Shared>;
// Can't iterate mutably over `NSString`?
fn iter_mut<'a>(&'a mut self) -> Self::Enumerator<'a, Self, Owned>
where
<Self::Item as INSObject>::Own = Owned;
}
struct NSEnumerator<'a, T, O: Ownership>(...);
impl Iterator for NSEnumerator<'a, T, Shared> {
type Item = &'a T;
fn next(&'a mut self) -> Self::Item {...}
}
impl Iterator for NSEnumerator<'a, T, Owned> {
type Item = &'a mut T;
fn next(&'a mut self) -> Self::Item {...}
}
// How does NSFastEnumeration work?
|
madsmtm
changed the title
Fix ownership in
Fix ownership in Nov 3, 2021
objc_foundation
objc-foundation
madsmtm
changed the title
Fix ownership in
Fix ownership in Nov 3, 2021
objc-foundation
objc2-foundation
Fixed in #40, other points are moved to other issues |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After #21 I can go through
objc2-foundation
and re-evaluate how we should do the ownership stuff. Especially difficult with generic objects likeNSArray
!The idea is it we fix the soundness issues in SSheldon/rust-objc-foundation#10, see my comment there.
Probably some rework of
INSObject
is required.Should also figure out the safety of "downgrading" (e.g.Moved to #58&MyObject -> &NSObject
)? And from there&NSObject -> Id<NSObject, Shared>
(which deletes the original lifetime). What about whenMyObject<'a>
itself carries lifetime information? Maybe add lifetime toId
?Also, should we add anMoved to #66ObjectType
/RetainAble
/... type, since not allMessage
types can actually be used inId
?Idea:
The text was updated successfully, but these errors were encountered: