@@ -129,6 +129,12 @@ impl<T> Retained<T> {
129
129
}
130
130
}
131
131
132
+ /// TODO
133
+ #[ doc( alias = "objc_retainAutoreleasedReturnValue" ) ]
134
+ pub unsafe fn retain_autoreleased_return ( obj : & T ) -> Self {
135
+ todo ! ( )
136
+ }
137
+
132
138
/// Autoreleases the retained pointer, meaning that the object is not
133
139
/// immediately released, but will be when the innermost / current
134
140
/// autorelease pool is drained.
@@ -150,13 +156,46 @@ impl<T> Retained<T> {
150
156
ptr
151
157
}
152
158
153
- #[ cfg( test) ]
159
+ /// TODO
160
+ #[ doc( alias = "objc_autoreleaseReturnValue" ) ]
161
+ pub fn autorelease_return ( self ) -> * const T {
162
+ todo ! ( )
163
+ }
164
+
165
+ /// TODO
166
+ ///
167
+ /// Equivalent to `Retained::retain(&obj).autorelease()`, but slightly
168
+ /// more efficient.
169
+ #[ doc( alias = "objc_retainAutorelease" ) ]
170
+ pub unsafe fn retain_and_autorelease ( obj : & T ) -> * const T {
171
+ todo ! ( )
172
+ }
173
+
174
+ /// TODO
175
+ ///
176
+ /// Equivalent to `Retained::retain(&obj).autorelease_return()`, but
177
+ /// slightly more efficient.
178
+ #[ doc( alias = "objc_retainAutoreleaseReturnValue" ) ]
179
+ pub unsafe fn retain_and_autorelease_return ( obj : & T ) -> * const T {
180
+ todo ! ( )
181
+ }
182
+
183
+ #[ cfg( test) ] // TODO
154
184
#[ doc( alias = "retainCount" ) ]
155
185
pub fn retain_count ( & self ) -> usize {
156
186
unsafe { msg_send ! [ self . ptr. as_ptr( ) as * mut Object , retainCount] }
157
187
}
158
188
}
159
189
190
+ // TODO: Consider something like this
191
+ // #[cfg(block)]
192
+ // impl<T: Block> Retained<T> {
193
+ // #[doc(alias = "objc_retainBlock")]
194
+ // pub unsafe fn retain_block(block: &T) -> Self {
195
+ // todo!()
196
+ // }
197
+ // }
198
+
160
199
// TODO: #[may_dangle]
161
200
// https://doc.rust-lang.org/nightly/nomicon/dropck.html
162
201
impl < T > Drop for Retained < T > {
0 commit comments