concordium-std 10.1.0

A standard library for writing smart contracts for the Concordium blockchain in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! This test checks that you cannot have multiple entries from a `StateMap`
//! alive at the same time.
//!
//! When compiling it, the borrow-checker is supposed to throw an error.
use concordium_std::*;

pub fn main() {
    let mut state_builder = StateBuilder::open(ExternStateApi::open());
    let mut map: StateMap<u8, u8, _> = state_builder.new_map();
    // Get two entries.
    let e1 = map.entry(0u8);
    let e2 = map.entry(1u8);
    // Use them, so we are certain that their lifetimes overlap.
    e1.or_insert(1);
    e2.or_insert(2);
}