pub trait OmpComponentHandle: Sized + Copy {
const UID: u64;
// Required methods
unsafe fn from_raw(ptr: NonNull<ServerComponent>) -> Self;
fn as_raw(&self) -> NonNull<ServerComponent>;
}Expand description
Trait implemented by typed wrappers for Open Multiplayer components.
Each implementation:
- Provides the component’s constant
UIDinUID. - Constructs itself from a
NonNull<ServerComponent>returned bysamp_sdk::omp::server::query_component. - Exposes the raw pointer via
as_raw.
Required Associated Constants§
Required Methods§
Sourceunsafe fn from_raw(ptr: NonNull<ServerComponent>) -> Self
unsafe fn from_raw(ptr: NonNull<ServerComponent>) -> Self
Builds the wrapper from the pointer returned by query_component.
§Safety
ptr must have been obtained via query_component(_, Self::UID) and the
server must keep the component alive while the wrapper is used.
Sourcefn as_raw(&self) -> NonNull<ServerComponent>
fn as_raw(&self) -> NonNull<ServerComponent>
Returns the raw component pointer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".