Struct xpcom::GetterAddrefs [] [src]

pub struct GetterAddrefs<T: RefCounted + 'static> { /* fields omitted */ }

A helper struct for constructing RefPtr<T> from raw pointer outparameters. Holds a *const T internally which will be released if non null when destructed, and can be easily transformed into an Option<RefPtr<T>>.

It many cases it may be easier to use the getter_addrefs method.

Methods

impl<T: RefCounted + 'static> GetterAddrefs<T>
[src]

[src]

Create a GetterAddrefs, initializing it with the null pointer.

[src]

Get a reference to the internal *const T. This method is unsafe, as the destructor of this class depends on the internal *const T being either a valid reference to a value of type T, or null.

[src]

Get a reference to the internal *const T as a *mut libc::c_void. This is useful to pass to functions like GetInterface which take a void pointer outparameter.

[src]

Transform this GetterAddrefs into an Option<RefPtr<T>>, without performing any addrefs or releases.

Trait Implementations

impl<T: RefCounted + 'static> Drop for GetterAddrefs<T>
[src]

[src]

Executes the destructor for this type. Read more