Skip to main content

ComponentInterface

Trait ComponentInterface 

Source
pub trait ComponentInterface {
    const UID: u64;
    const COMPONENT_OFFSET: isize = 0;
}
Expand description

A server interface reachable as a component, and the UID that finds it.

Implemented for the opaque interface handles (IObjectsComponent, IVehiclesComponent, …). Tying the UID to the type is what Component builds on: the lookup and the cast cannot disagree.

Required Associated Constants§

Source

const UID: u64

The component’s UID, as the server’s headers declare it.

Provided Associated Constants§

Source

const COMPONENT_OFFSET: isize = 0

Where the IComponent subobject sits inside the interface.

The server hands out an IComponent*. For almost every component that is the start of the object, because IComponent is the first base; for INPCComponent the pool comes first and the IComponent sits after its vtable pointer, so the pointer has to move back before the interface’s own methods can be called through it. From clang’s record layout, per ABI.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ComponentInterface for IActorsComponent

Source§

const UID: u64 = ACTORS_COMPONENT_UID

Source§

impl ComponentInterface for ICheckpointsComponent

Source§

const UID: u64 = CHECKPOINTS_COMPONENT_UID

Source§

impl ComponentInterface for IClassesComponent

Source§

const UID: u64 = CLASSES_COMPONENT_UID

Source§

impl ComponentInterface for IConsoleComponent

Source§

const UID: u64 = CONSOLE_COMPONENT_UID

Source§

impl ComponentInterface for ICustomModelsComponent

Source§

const UID: u64 = CUSTOM_MODELS_COMPONENT_UID

Source§

impl ComponentInterface for IDatabasesComponent

Source§

const UID: u64 = DATABASES_COMPONENT_UID

Source§

impl ComponentInterface for IDialogsComponent

Source§

const UID: u64 = DIALOGS_COMPONENT_UID

Source§

impl ComponentInterface for IGangZonesComponent

Source§

const UID: u64 = GANGZONES_COMPONENT_UID

Source§

impl ComponentInterface for IMenusComponent

Source§

const UID: u64 = MENUS_COMPONENT_UID

Source§

impl ComponentInterface for INPCComponent

Source§

const UID: u64 = NPCS_COMPONENT_UID

Source§

const COMPONENT_OFFSET: isize = 8

Source§

impl ComponentInterface for IObjectsComponent

Source§

const UID: u64 = OBJECTS_COMPONENT_UID

Source§

impl ComponentInterface for IPickupsComponent

Source§

const UID: u64 = PICKUPS_COMPONENT_UID

Source§

impl ComponentInterface for IRecordingsComponent

Source§

const UID: u64 = RECORDINGS_COMPONENT_UID

Source§

impl ComponentInterface for ITextDrawsComponent

Source§

const UID: u64 = TEXTDRAWS_COMPONENT_UID

Source§

impl ComponentInterface for ITextLabelsComponent

Source§

const UID: u64 = TEXTLABELS_COMPONENT_UID

Source§

impl ComponentInterface for ITimersComponent

Source§

const UID: u64 = TIMERS_COMPONENT_UID

Source§

impl ComponentInterface for IVariablesComponent

Source§

const UID: u64 = VARIABLES_COMPONENT_UID

Source§

impl ComponentInterface for IVehiclesComponent

Source§

const UID: u64 = VEHICLES_COMPONENT_UID