pub struct Storage {
    pub api: Box<dyn StorageAPI>,
}
Expand description

Storage object

Fields

api: Box<dyn StorageAPI>

APIs the provided by th host

Implementations

creates a new instance of storage

reads 1 byte(s) from storage file at the given offset and converts it to u8.

converts u8 to 1 byte(s) and writes into storage file at the given offset.

reads 2 byte(s) from storage file at the given offset and converts it to u16.

converts u16 to 2 byte(s) and writes into storage file at the given offset.

reads 4 byte(s) from storage file at the given offset and converts it to u32.

converts u32 to 4 byte(s) and writes into storage file at the given offset.

reads 8 byte(s) from storage file at the given offset and converts it to u64.

converts u64 to 8 byte(s) and writes into storage file at the given offset.

reads 1 byte(s) from storage file at the given offset and converts it to i8.

converts i8 to 1 byte(s) and writes into storage file at the given offset.

reads 2 byte(s) from storage file at the given offset and converts it to i16.

converts i16 to 2 byte(s) and writes into storage file at the given offset.

reads 4 byte(s) from storage file at the given offset and converts it to i32.

converts i32 to 4 byte(s) and writes into storage file at the given offset.

reads 8 byte(s) from storage file at the given offset and converts it to i64.

converts i64 to 8 byte(s) and writes into storage file at the given offset.

reads 1 byte from storage file at the given offset and converts it to bool.

converts bool to 1 byte(s) and writes into storage file at the given offset.

reads string from the storage file at the given offset.

write string to the storage file at the given offset. if the length string is greater than max_length it wil be truncated to the max length.

reads struct T from the storage file at the given offset

writes struct T to the storage file at the given offset

writes data into the storage file at the given offset

reads data from the storage file at the given offset and length

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.