Trait multiversx_sc::types::ManagedType
source · pub trait ManagedType<M: ManagedTypeApi>: Sized {
type OwnHandle: HandleConstraints;
// Required methods
fn get_handle(&self) -> Self::OwnHandle;
fn transmute_from_handle_ref(handle_ref: &Self::OwnHandle) -> &Self;
// Provided methods
fn get_raw_handle(&self) -> RawHandle { ... }
fn as_ref(&self) -> ManagedRef<'_, M, Self> { ... }
}
Expand description
Commonalities between all managed types.
Required Associated Types§
Required Methods§
fn get_handle(&self) -> Self::OwnHandle
sourcefn transmute_from_handle_ref(handle_ref: &Self::OwnHandle) -> &Self
fn transmute_from_handle_ref(handle_ref: &Self::OwnHandle) -> &Self
Implement carefully, since the underlying transmutation is an unsafe operation. For types that wrap a handle to some VM-managed data, make sure the type only contains the handle (plus ZSTs if necessary). For types that just wrap another managed type it is easier, call for the wrapped object.
Provided Methods§
fn get_raw_handle(&self) -> RawHandle
fn as_ref(&self) -> ManagedRef<'_, M, Self>
Object Safety§
This trait is not object safe.