pub struct SerializationInterface(/* private fields */);
Expand description
Interface for interacting with SKSE’s serialization functions.
This struct provides methods for interacting with serialization operations such as setting unique IDs, handling callbacks for form deletions and loads, and reading/writing record data.
Implementations§
Source§impl SerializationInterface
impl SerializationInterface
Sourcepub fn set_unique_id(&self, uid: u32) -> Result<(), ApiStorageError>
pub fn set_unique_id(&self, uid: u32) -> Result<(), ApiStorageError>
Sets a unique identifier for the serialization interface.
§Errors
Returns an error if the internal global API storage is uninitialized
(e.g., if skse::init
has not been called).
Sourcepub fn set_form_delete_callback(
&self,
callback: fn(handle: VMHandle),
) -> Result<(), ApiStorageError>
pub fn set_form_delete_callback( &self, callback: fn(handle: VMHandle), ) -> Result<(), ApiStorageError>
Sets a callback function that will be called when a form is deleted.
§Errors
Returns an error if the internal global API storage is uninitialized
(e.g., if skse::init
has not been called).
Sourcepub fn set_load_callback(
&self,
callback: fn(&Self),
) -> Result<(), ApiStorageError>
pub fn set_load_callback( &self, callback: fn(&Self), ) -> Result<(), ApiStorageError>
Sets a callback function that will be called when the plugin is loaded.
§Errors
Returns an error if the internal global API storage is uninitialized
(e.g., if skse::init
has not been called).
Sourcepub fn set_revert_callback(
&self,
callback: fn(&Self),
) -> Result<(), ApiStorageError>
pub fn set_revert_callback( &self, callback: fn(&Self), ) -> Result<(), ApiStorageError>
Sets a callback function that will be called when the plugin is reverted.
§Errors
Returns an error if the internal global API storage is uninitialized
(e.g., if skse::init
has not been called).
Sourcepub fn set_save_callback(
&self,
callback: fn(&Self),
) -> Result<(), ApiStorageError>
pub fn set_save_callback( &self, callback: fn(&Self), ) -> Result<(), ApiStorageError>
Sets a callback function that will be called when the plugin is saved.
§Errors
Returns an error if the internal global API storage is uninitialized
(e.g., if skse::init
has not been called).
Sourcepub fn write_record<T>(
&self,
record_type: u32,
version: u32,
buf: &T,
) -> Result<(), Error>
pub fn write_record<T>( &self, record_type: u32, version: u32, buf: &T, ) -> Result<(), Error>
Writes a record to the serialization interface.
§Errors
Returns an error if the write operation fails or if the buffer length exceeds u32::MAX
.
Sourcepub fn write_record_data<T>(&self, buf: &[T]) -> Result<(), Error>
pub fn write_record_data<T>(&self, buf: &[T]) -> Result<(), Error>
Writes record data to the serialization interface.
§Errors
Returns an error if the write operation fails or if the buffer length exceeds u32::MAX
.
Sourcepub fn read_record_data<T>(&self, buf: &mut [T]) -> u32
pub fn read_record_data<T>(&self, buf: &mut [T]) -> u32
Sourcepub fn get_next_record_info(
&self,
record_type: &mut u32,
version: &mut u32,
length: &mut u32,
) -> Result<(), Error>
pub fn get_next_record_info( &self, record_type: &mut u32, version: &mut u32, length: &mut u32, ) -> Result<(), Error>
Retrieves the next record’s type, version, and length.
§Errors
Returns an error if the operation fails.
Trait Implementations§
Source§impl Clone for SerializationInterface
impl Clone for SerializationInterface
Source§fn clone(&self) -> SerializationInterface
fn clone(&self) -> SerializationInterface
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more