pub struct OpaqueContextPtr<T>(/* private fields */);Expand description
Wraps a context pointer such that it can be passed to the Afia host, but it cannot be accessed by the site component.
This is useful when the component is already holding an &mut T reference and wishes to avoid
unintentionally creating two mutable references.
TODO: Not sure whether the afia-component will eventually abstract this away such that
the user does not need to use it… so… not including an example for now.
Implementations§
Source§impl<T> OpaqueContextPtr<T>
impl<T> OpaqueContextPtr<T>
Sourcepub fn to_i32(&self) -> i32
pub fn to_i32(&self) -> i32
Get an i32 that can get sent from the component to the Afia host.
TODO: Make the afia-component methods that call the Afia host take this
[OpaqueContextPointer] as an argument and then we can use Context::to_isize
to convert it to isize from within afia-component.
Then we can delete this to_i32 method.
This way the site component can’t get access to the underlying value, making this
a truly opaque wrapper.