rust-samp-sdk 3.6.0

Low-level FFI bindings for the SA-MP AMX virtual machine and open.mp native component ABI. Used internally by `rust-samp`; depend on it directly only if you need raw access without the higher-level macros and lifecycle.
Documentation
//! `IPlayerMenuData` — generated by `cargo xtask gen-omp` from `Server/Components/Menus/menus.hpp`.
//! Implemented by `PlayerMenuData` in the server's `Menus`.
//!
//! Do not edit: change `xtask/omp-wrappers.toml` or the generator and
//! regenerate. Slots are clang's layout of the header for each ABI, checked
//! against the official binaries by `cargo xtask check-abi --generated`.

#![allow(unused_imports)]

use crate::omp::containers::{FlatSet, HybridString, Pair, Span};
use crate::omp::types::{
    Colour, GTAQuat, Hours, Microseconds, Milliseconds, Minutes, Seconds, StringView, TimePoint,
    UID, Vector2, Vector3, Vector4, WorldTimePoint,
};
use crate::omp::vtable::{call_vtable_small_struct, opaque, slots, virtual_fns};
use crate::omp::*;

opaque! {
    /// Opaque handle for `IPlayerMenuData*`.
    pub IPlayerMenuData;
}

/// `PlayerMenuData_UID` in `Server/Components/Menus/menus.hpp`.
pub const PLAYER_MENUS_UID: UID = 0x01d8e934e9791b99;

/// The player's `IPlayerMenuData`, or null when the component providing it is not loaded.
///
/// Found by walking the player's extension map for `PLAYER_MENUS_UID` — the
/// virtual `getExtension` does not consult that map. `IExtension`
/// is `IPlayerMenuData`'s first base, so the extension pointer is the interface pointer.
///
/// # Safety
/// `player` must be a live `IPlayer`.
#[must_use]
pub unsafe fn player_menus(player: *mut IPlayer) -> *mut IPlayerMenuData {
    unsafe { extension(player.cast::<u8>(), PLAYER_MENUS_UID) }.cast::<IPlayerMenuData>()
}

slots! {
    /// `uint8_t IPlayerMenuData::getMenuID()`
    SLOT_GET_MENU_ID: usize = 3, 3;
    /// `void IPlayerMenuData::setMenuID(uint8_t)`
    SLOT_SET_MENU_ID: usize = 4, 4;
}

virtual_fns! {
    /// `uint8_t IPlayerMenuData::getMenuID()`.
    ///
    /// # Safety
    /// `data` must be a live `IPlayerMenuData`.
    #[must_use]
    pub fn player_menus_menu_id(data: IPlayerMenuData) -> u8 = [0, SLOT_GET_MENU_ID] or 0;

    /// `void IPlayerMenuData::setMenuID(uint8_t)`.
    ///
    /// # Safety
    /// `data` must be a live `IPlayerMenuData`.
    pub fn player_menus_set_menu_id(data: IPlayerMenuData, id: u8) = [0, SLOT_SET_MENU_ID];
}