[][src]Crate lib

Documentation for rust_storage_interface_library

Add as a dependency

Add the following line to the [dependencies] section of your applications Cargo.toml file (please confirm latest version number at crates.io)

[dependencies]
rust_storage_interface_library = "^0.1"

Bring into scope

use rust_storage_interface_library::ssvm_storage;

Store and load a String

This essentially stores and loads high level objects like strings by serializing them into an array of i32 variables. All you need to do is use the following simple syntax

 let my_string = String::from("A string to store");
 let storage_key: i64 = ssvm_storage::store::store_string(&my_string);
 let new_string: String = ssvm_storage::load::load_string(storage_key);

Load a single i32

let my_previously_stored_i32_value: i32 = ssvm_storage::load::loadi32(my_previously_saved_key: i64)

Load a single i64

let my_previously_stored_i64_value: i64 = ssvm_storage::load::loadi64(my_previously_saved_key)

Store a single i32

Stores a single i32 value and returns a key which can be used to fetch the stored i32 value at a later date

my_i32_to_store: i32 = 88;
my_new_key: i64 = ssvm_storage::store::storei32(my_i32_to_store)

Store a single i64

Stores a single i64 value and returns a key which can be used to fetch the stored i64 value at a later date

my_i64_to_store: i64 = 88;
my_new_key: i64 = ssvm_storage::store::storei64(my_i64_to_store)