Struct objc2::rc::AutoreleasePool [−][src]
pub struct AutoreleasePool { /* fields omitted */ }
Expand description
Implementations
Returns a shared reference to the given autoreleased pointer object.
This is the preferred way to make references from autoreleased objects, since it binds the lifetime of the reference to the pool, and does some extra checks when debug assertions are enabled.
For the mutable counterpart see ptr_as_mut
.
Safety
This is equivalent to &*ptr
, and shares the unsafety of that, except
the lifetime is bound to the pool instead of being unbounded.
Returns a unique reference to the given autoreleased pointer object.
This is the preferred way to make mutable references from autoreleased objects, since it binds the lifetime of the reference to the pool, and does some extra checks when debug assertions are enabled.
For the shared counterpart see ptr_as_ref
.
Safety
This is equivalent to &mut *ptr
, and shares the unsafety of that,
except the lifetime is bound to the pool instead of being unbounded.
Trait Implementations
Drains the autoreleasepool.
The clang documentation says that @autoreleasepool
blocks are not
drained when exceptions occur because:
Not draining the pool during an unwind is apparently required by the Objective-C exceptions implementation.
This was true in the past, but since revision 371
of objc4 (ships
with MacOS 10.5) the exception is now retained when @throw
is
encountered.
Hence it is safe to drain the pool when unwinding.
TODO: Verify this claim on 32bit!