thruput-sdk 0.58.0

Thruput smart-contract SDK for Rust (rv32 guest runtime and native test harness)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::sys::{self, SysErr};
use crate::sys_exn::flags::lock_after_write;
use crate::types::StorageKey;

/// Deletes the value at `key`. The key's storage flags stay as they are.
pub fn delete_shared(key: &StorageKey) -> Result<(), SysErr> {
    sys::raw_DeleteObject(key)
}

/// Deletes the value at `key`, then requests
/// [`ExclusiveLock`](crate::StorageDeltaFlags::ExclusiveLock) for it. If the
/// deletion fails, no lock is requested.
pub fn delete_exclusive(key: &StorageKey) -> Result<(), SysErr> {
    sys::raw_DeleteObject(key)?;
    lock_after_write(key, true);
    Ok(())
}