pub struct MessagingInterface(/* private fields */);
Expand description
APIs that enable data to be sent and received between plugins.
Implementations§
Source§impl MessagingInterface
impl MessagingInterface
Sourcepub fn dispatch<T>(
&self,
message_type: MessageType,
data: &mut T,
data_len: u32,
receiver: Option<&CStr>,
) -> Result<(), MessagingError>
pub fn dispatch<T>( &self, message_type: MessageType, data: &mut T, data_len: u32, receiver: Option<&CStr>, ) -> Result<(), MessagingError>
Dispatches a message to SKSE listeners.
§Errors
If the internal global API storage is uninitialized because forgot to call skse::init
Sourcepub unsafe fn dispatch_raw(
&self,
message_type: MessageType,
data: *mut c_void,
data_len: u32,
receiver: Option<&CStr>,
) -> Result<(), MessagingError>
pub unsafe fn dispatch_raw( &self, message_type: MessageType, data: *mut c_void, data_len: u32, receiver: Option<&CStr>, ) -> Result<(), MessagingError>
Sourcepub fn get_event_dispatcher(&self, dispatcher_id: Dispatcher) -> *mut c_void
pub fn get_event_dispatcher(&self, dispatcher_id: Dispatcher) -> *mut c_void
Gets the event dispatcher for a specific dispatcher id.
Sourcepub fn register_skse_listener(
&self,
f: fn(msg: &Message),
) -> Result<(), MessagingError>
pub fn register_skse_listener( &self, f: fn(msg: &Message), ) -> Result<(), MessagingError>
Registers a listener for SKSE’s in-game events (e.g., loading saves).
§Errors
If the internal global API storage is uninitialized because forgot to call skse::init
§Event Data
PreLoadGame
: The name of the save dataPostLoadGame
: Invalid ptr(data length 1)
§Example
if let Ok(messaging) = commonlibsse_ng::skse::api::get_messaging_interface() {
messaging.register_skse_listener(|message| {
#[cfg(feature = "tracing")]
tracing::info!("SKSE event: {message:#?}");
});
}
Sourcepub fn register_listener(
&self,
sender: &CStr,
f: fn(msg: &Message),
) -> Result<(), MessagingError>
pub fn register_listener( &self, sender: &CStr, f: fn(msg: &Message), ) -> Result<(), MessagingError>
Registers a listener for a specific plugin’s in-game events.
§Errors
If the internal global API storage is uninitialized because forgot to call skse::init
Trait Implementations§
Source§impl Clone for MessagingInterface
impl Clone for MessagingInterface
Source§fn clone(&self) -> MessagingInterface
fn clone(&self) -> MessagingInterface
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for MessagingInterface
impl RefUnwindSafe for MessagingInterface
impl Send for MessagingInterface
impl Sync for MessagingInterface
impl Unpin for MessagingInterface
impl UnwindSafe for MessagingInterface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more