Module sui::table_vec
A basic scalable vector library implemented using Table.
use std::ascii;
use std::bcs;
use std::option;
use std::string;
use std::vector;
use sui::address;
use sui::dynamic_field;
use sui::hex;
use sui::object;
use sui::table;
use sui::tx_context;
Struct TableVec
public struct TableVec<phantom Element: store> has store
Click to open
Fields
- contents: sui::table::Table<u64, Element>
- The contents of the table vector.
Constants
const EIndexOutOfBound: u64 = 0;
const ETableNonEmpty: u64 = 1;
Function empty
Create an empty TableVec.
public fun empty<Element: store>(ctx: &mut sui::tx_context::TxContext): sui::table_vec::TableVec<Element>
Function singleton
Return a TableVec of size one containing element e.
public fun singleton<Element: store>(e: Element, ctx: &mut sui::tx_context::TxContext): sui::table_vec::TableVec<Element>
Function length
Return the length of the TableVec.
public fun length<Element: store>(t: &sui::table_vec::TableVec<Element>): u64
Function is_empty
Return if the TableVec is empty or not.
public fun is_empty<Element: store>(t: &sui::table_vec::TableVec<Element>): bool
Function borrow
Acquire an immutable reference to the ith element of the TableVec t.
Aborts if i is out of bounds.
public fun borrow<Element: store>(t: &sui::table_vec::TableVec<Element>, i: u64): &Element