API
#maps
Xu 0.8.8 API
import: #maps
counts: 4 fns, 22 methods, 2 types, 0 consts, 0 ifaces
Library StrInt/StrStr maps. Language map[K]V is builtin and does not go through this package.
struct StrInt
pub struct StrInt {
pub keys []string
pub vals []int
pub used []int
pub n int
pub cap int
}
Purpose
Open-addressing string-key maps. Language `map[K]V` is L-C; this package is the user-facing table until then. used: 0 empty, 1 live, 2 tombstone.
Parameters
keys []string- field ([]string)
vals []int- field ([]int)
used []int- field ([]int)
n int- count, length, or limit
cap int- field (int)
struct StrStr
pub struct StrStr {
pub keys []string
pub vals []string
pub used []int
pub n int
pub cap int
}
Purpose
Public struct `StrStr`.
Parameters
keys []string- field ([]string)
vals []string- field ([]string)
used []int- field ([]int)
n int- count, length, or limit
cap int- field (int)
new_str_int
pub fn new_str_int() StrInt
Purpose
Construct str int.
Parameters
none
Returns
StrInt — a value of this type
new_str_str
pub fn new_str_str() StrStr
Purpose
Construct str str.
Parameters
none
Returns
StrStr — a value of this type
(&mut StrInt) set
pub fn (m &mut StrInt) set(k string, v int)
Purpose
Call `set` on `&mut StrInt`.
Parameters
m &mut StrInt- receiver &mut StrInt (exclusive borrow)
k string- key or index (string)
v int- value (int)
(&mut StrStr) set
pub fn (m &mut StrStr) set(k string, v string)
Purpose
Call `set` on `&mut StrStr`.
Parameters
m &mut StrStr- receiver &mut StrStr (exclusive borrow)
k string- key or index (string)
v string- value (string)
(&StrInt) has
pub fn (m &StrInt) has(k string) bool
Purpose
Call `has` on `&StrInt`.
Parameters
m &StrInt- receiver &StrInt (borrow)
k string- key or index (string)
Returns
bool — true or false
(&StrStr) has
pub fn (m &StrStr) has(k string) bool
Purpose
Call `has` on `&StrStr`.
Parameters
m &StrStr- receiver &StrStr (borrow)
k string- key or index (string)
Returns
bool — true or false
(&StrInt) get
pub fn (m &StrInt) get(k string) int
Purpose
Call `get` on `&StrInt`. Throws on failure.
Parameters
m &StrInt- receiver &StrInt (borrow)
k string- key or index (string)
Returns
int — a value of this type
(&StrStr) get
pub fn (m &StrStr) get(k string) string
Purpose
Call `get` on `&StrStr`. Throws on failure.
Parameters
m &StrStr- receiver &StrStr (borrow)
k string- key or index (string)
Returns
string — result string
(&mut StrInt) del
pub fn (m &mut StrInt) del(k string)
Purpose
Call `del` on `&mut StrInt`.
Parameters
m &mut StrInt- receiver &mut StrInt (exclusive borrow)
k string- key or index (string)
(&mut StrStr) del
pub fn (m &mut StrStr) del(k string)
Purpose
Call `del` on `&mut StrStr`.
Parameters
m &mut StrStr- receiver &mut StrStr (exclusive borrow)
k string- key or index (string)
(&mut StrInt) clear
pub fn (m &mut StrInt) clear()
Purpose
Call `clear` on `&mut StrInt`.
Parameters
m &mut StrInt- receiver &mut StrInt (exclusive borrow)
(&mut StrStr) clear
pub fn (m &mut StrStr) clear()
Purpose
Call `clear` on `&mut StrStr`.
Parameters
m &mut StrStr- receiver &mut StrStr (exclusive borrow)
(&StrInt) len
pub fn (m &StrInt) len() int
Purpose
Method on `&StrInt`: return the length.
Parameters
m &StrInt- receiver &StrInt (borrow)
Returns
int — a value of this type
(&StrStr) len
pub fn (m &StrStr) len() int
Purpose
Method on `&StrStr`: return the length.
Parameters
m &StrStr- receiver &StrStr (borrow)
Returns
int — a value of this type
(&StrInt) keys
pub fn (m &StrInt) keys() []string
Purpose
Call `keys` on `&StrInt`.
Parameters
m &StrInt- receiver &StrInt (borrow)
Returns
[]string — slice result
(&StrStr) keys
pub fn (m &StrStr) keys() []string
Purpose
Call `keys` on `&StrStr`.
Parameters
m &StrStr- receiver &StrStr (borrow)
Returns
[]string — slice result
(&StrInt) values
pub fn (m &StrInt) values() []int
Purpose
Call `values` on `&StrInt`.
Parameters
m &StrInt- receiver &StrInt (borrow)
Returns
[]int — slice result
(&StrStr) values
pub fn (m &StrStr) values() []string
Purpose
Call `values` on `&StrStr`.
Parameters
m &StrStr- receiver &StrStr (borrow)
Returns
[]string — slice result
(&StrInt) clone
pub fn (m &StrInt) clone() StrInt
Purpose
Method on `&StrInt`: copy into a new independent string.
Parameters
m &StrInt- receiver &StrInt (borrow)
Returns
StrInt — a value of this type
(&StrStr) clone
pub fn (m &StrStr) clone() StrStr
Purpose
Method on `&StrStr`: copy into a new independent string.
Parameters
m &StrStr- receiver &StrStr (borrow)
Returns
StrStr — a value of this type
(&StrInt) equal
pub fn (m &StrInt) equal(o &StrInt) bool
Purpose
Method on `&StrInt`: report whether the two values are equal.
Parameters
m &StrInt- receiver &StrInt (borrow)
o &StrInt- o (borrowed; caller keeps it; type &StrInt)
Returns
bool — true or false
(&StrStr) equal
pub fn (m &StrStr) equal(o &StrStr) bool
Purpose
Method on `&StrStr`: report whether the two values are equal.
Parameters
m &StrStr- receiver &StrStr (borrow)
o &StrStr- o (borrowed; caller keeps it; type &StrStr)
Returns
bool — true or false
copy_str_int
pub fn copy_str_int(dst &mut StrInt, src &StrInt)
Purpose
Copy str int.
Parameters
dst &mut StrInt- destination (exclusive borrow; type &mut StrInt)
src &StrInt- source (borrowed; caller keeps it; type &StrInt)
copy_str_str
pub fn copy_str_str(dst &mut StrStr, src &StrStr)
Purpose
Copy str str.
Parameters
dst &mut StrStr- destination (exclusive borrow; type &mut StrStr)
src &StrStr- source (borrowed; caller keeps it; type &StrStr)
(&mut StrInt) delete_func
pub fn (m &mut StrInt) delete_func(f fn(string, int) bool)
Purpose
Method on `&mut StrInt`: delete callback.
Parameters
m &mut StrInt- receiver &mut StrInt (exclusive borrow)
f fn(string, int) bool- byte callback: argument is 0..255, return whether it matches
(&mut StrStr) delete_func
pub fn (m &mut StrStr) delete_func(f fn(string, string) bool)
Purpose
Method on `&mut StrStr`: delete callback.
Parameters
m &mut StrStr- receiver &mut StrStr (exclusive borrow)
f fn(string, string) bool- byte callback: argument is 0..255, return whether it matches