Struct stack_vm::WriteOnceTable [] [src]

pub struct WriteOnceTable<T>(_);

A table which does not allow values to be overwritten. Useful for your languages constants, etc.

use stack_vm::{WriteOnceTable, Table};
let mut table: WriteOnceTable<usize> = WriteOnceTable::new();
assert!(table.is_empty());

table.insert("example", 13);
assert!(!table.is_empty());

assert!(table.contains_key("example"));

let value = *table.get("example").unwrap();
assert_eq!(value, 13);
use stack_vm::{WriteOnceTable, Table};
let mut table: WriteOnceTable<usize> = WriteOnceTable::new();
table.insert("example", 13);
table.insert("example", 14);

Methods

impl<T> WriteOnceTable<T>
[src]

[src]

Return a new, empty WriteOnceTable.

[src]

Trait Implementations

impl<T: Debug> Debug for WriteOnceTable<T>
[src]

[src]

Formats the value using the given formatter.

impl<T> Table for WriteOnceTable<T>
[src]

The type for items stored and retrieved from the table.

[src]

Insert a value into the table using a string key.

[src]

Is the table empty or not?

[src]

Does the table contain the key or not?

[src]

Retrieve a reference to a value stored in the table by key.