1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! State Persist capability entrypoints
/// `ark_state_persist` - Persist out module state
///
/// If the function is successful then it will return a memory buffer through the Ark return slice mechanism, and return `ErrorCode::Success`.
///
/// # Example
///
/// ```ignore
/// #[no_mangle]
/// pub fn ark_state_persist() -> ErrorCode {
/// match your_save_module_state() {
/// Ok(state) => {
/// ark::core::return_slice(&state);
/// ErrorCode::Success
/// }
/// Err(_) => ErrorCode::InternalError,
/// }
/// }
pub type StatePersistFn = fn ;
/// `ark_state_restore` - Restore module state
///
/// The parameter is a previously persisted state, accessible a `u8` memory slice with that is stored in the Wasm module's memory.
///
/// # Example
///
/// ```ignore
/// pub fn ark_state_load(state_ptr: *const u8, state_size: u32) -> ErrorCode {
/// let state = std::slice::from_raw_parts(state_ptr, state_size as usize);
/// match your_load_module_state(state) {
/// Ok(_) => ErrorCode::Success,
/// Err(_) => ErrorCode::InternalError,
/// }
/// }
/// ```
pub type StateRestoreFn = fn ;
pub const STATE_PERSIST: &str = "ark_state_persist";
pub const STATE_RESTORE: &str = "ark_state_restore";