Skip to main content

OmpComponentHandle

Trait OmpComponentHandle 

Source
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:

Required Associated Constants§

Source

const UID: u64

Component UID — known at compile time.

Required Methods§

Source

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.

Source

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".

Implementors§

Source§

impl OmpComponentHandle for PawnComponent

Source§

const UID: u64 = PAWN_COMPONENT_UID

Source§

impl OmpComponentHandle for TimersComponent

Source§

const UID: u64 = TIMERS_COMPONENT_UID