Function near_sdk::env::storage_write

source ·
pub fn storage_write(key: &[u8], value: &[u8]) -> bool
Expand description

Writes key-value into storage. If another key-value existed in the storage with the same key it returns true, otherwise false.

Examples

use near_sdk::env::{storage_write, storage_read};

assert!(!storage_write(b"key", b"value"));
assert!(storage_write(b"key", b"another_value"));
assert_eq!(storage_read(b"key").unwrap(), b"another_value");