Skip to main content

LeviRsApi

Struct LeviRsApi 

Source
#[repr(C)]
pub struct LeviRsApi { pub abi_version: u32, pub struct_size: u32, pub log: unsafe extern "C" fn(mod_: LeviRsModHandle, level: i32, msg: LeviRsStr), pub gaming_status: unsafe extern "C" fn() -> i32, pub schedule: unsafe extern "C" fn(cb: LeviRsTaskCb, user: *mut c_void), pub schedule_after: unsafe extern "C" fn(cb: LeviRsTaskCb, user: *mut c_void, delay_ms: u64), pub subscribe_event: unsafe extern "C" fn(mod_: LeviRsModHandle, event_id: LeviRsStr, priority: i32, cb: LeviRsEventCb, user: *mut c_void) -> LeviRsListenerHandle, pub unsubscribe_event: unsafe extern "C" fn(mod_: LeviRsModHandle, listener: LeviRsListenerHandle) -> bool, pub list_events: unsafe extern "C" fn(ctx: *mut c_void, sink: LeviRsStrSink), pub execute_command: unsafe extern "C" fn(cmd: LeviRsStr, ctx: *mut c_void, sink: LeviRsCmdOutputSink) -> bool, pub register_command: unsafe extern "C" fn(mod_: LeviRsModHandle, name: LeviRsStr, description: LeviRsStr, permission: i32, cb: LeviRsCommandCb, user: *mut c_void) -> bool, }
Expand description

Function table handed to the Rust mod. Mirrors LeviRsApi.

Fields§

§abi_version: u32§struct_size: u32§log: unsafe extern "C" fn(mod_: LeviRsModHandle, level: i32, msg: LeviRsStr)

level: -1=Off, 0=Fatal, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Trace. Thread-safe.

§gaming_status: unsafe extern "C" fn() -> i32

0=Default, 1=Starting, 2=Running, 3=Stopping. Thread-safe.

§schedule: unsafe extern "C" fn(cb: LeviRsTaskCb, user: *mut c_void)

Queue onto the server thread ASAP. Thread-safe.

§schedule_after: unsafe extern "C" fn(cb: LeviRsTaskCb, user: *mut c_void, delay_ms: u64)

Queue onto the server thread after delay_ms. Thread-safe.

§subscribe_event: unsafe extern "C" fn(mod_: LeviRsModHandle, event_id: LeviRsStr, priority: i32, cb: LeviRsEventCb, user: *mut c_void) -> LeviRsListenerHandle

Server thread only. priority 0..4 (Highest..Lowest), 2 = Normal.

§unsubscribe_event: unsafe extern "C" fn(mod_: LeviRsModHandle, listener: LeviRsListenerHandle) -> bool

Server thread only.

§list_events: unsafe extern "C" fn(ctx: *mut c_void, sink: LeviRsStrSink)

Server thread only.

§execute_command: unsafe extern "C" fn(cmd: LeviRsStr, ctx: *mut c_void, sink: LeviRsCmdOutputSink) -> bool

Server thread only. Executes as console (Owner).

§register_command: unsafe extern "C" fn(mod_: LeviRsModHandle, name: LeviRsStr, description: LeviRsStr, permission: i32, cb: LeviRsCommandCb, user: *mut c_void) -> bool

Server thread only, call during on_enable. permission 0..4.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.