#[repr(C)]pub struct Message {
pub sender: *const c_char,
pub msg_type: MessageType_CEnum,
pub data_len: u32,
pub data: *mut c_void,
}
Expand description
Represents a message sent through the SKSE messaging system.
Fields§
§sender: *const c_char
The name of the sender as a C string.
msg_type: MessageType_CEnum
The type of message.
data_len: u32
The length of the data buffer.
data: *mut c_void
Pointer to the message data.
§Note
The pointer may be invalid, even if data_len
is non-zero.
Always use Message::get_valid_data
to safely access the data.
Implementations§
Source§impl Message
impl Message
Sourcepub fn get_valid_data(&self) -> Option<&[u8]>
pub fn get_valid_data(&self) -> Option<&[u8]>
Returns a valid memory slice of the message data, if accessible.
§Safety
- This function checks if the pointer is non-null and properly aligned.
- It also ensures that the memory range is valid before returning a reference.
§When None
is returned
- If
data_len
is 0. - If the data pointer is null, unaligned, or invalid.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl !Send for Message
impl !Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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