Skip to main content

set_inner

Function set_inner 

Source
pub unsafe fn set_inner<T>(this: *mut c_void, inner: *mut c_void)
Expand description

Makes the object of this the outer object of an aggregate: the object whose implementation of QueryInterface asks inner for every interface it was not made with, and which releases inner when it is destroyed.

This is how a class of the Windows Runtime is derived from (composition: the factory of a composable class creates the base object as the inner object of the outer object it is given, and hands out the inner object’s non-delegating IUnknown, whose interfaces count their references on the outer object). The MicroCom runtime has no counterpart: its objects are created by one side only. An object that is not composed answers for its own interfaces alone, as before.

Until this is called, the object answers for its own interfaces only, which is what the factory sees while it creates the inner object.

§Safety

this must be an interface pointer of a live object made by make_com or make_com_with whose value is a T, and inner an owned reference to the non-delegating IUnknown of an object that aggregates it (or null). The reference is the object’s from now on. An object has one inner object: an earlier one is released.