#maps
Xu 0.16.0 API
import: #maps
counts: 4 functions, 22 methods, 2 types, 0 constants, 0 method sets
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
Structure encapsulating keys, vals, used, n, cap.
Public fields
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
Structure encapsulating keys, vals, used, n, cap.
Public fields
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
No arguments are required.
Returns
StrInt — a value of this type
new_str_str
pub fn new_str_str() StrStr
Purpose
Construct str str.
Parameters
No arguments are required.
Returns
StrStr — a value of this type
($&StrInt) set
pub fn (m $&StrInt) set(k string, v int)
Purpose
Execute set on $&StrInt.
Parameters
m $&StrInt- The
StrInt instance used by this call (exclusive borrow).
k string- key or index (string)
v int- value (int)
Returns
This call does not return a value.
($&StrStr) set
pub fn (m $&StrStr) set(k string, v string)
Purpose
Execute set on $&StrStr.
Parameters
m $&StrStr- The
StrStr instance used by this call (exclusive borrow).
k string- key or index (string)
v string- value (string)
Returns
This call does not return a value.
(&StrInt) has
pub fn (m &StrInt) has(k string) bool
Purpose
Execute has on &StrInt.
Parameters
m &StrInt- The
StrInt instance used by this call (borrow).
k string- key or index (string)
Returns
bool — true or false
(&StrStr) has
pub fn (m &StrStr) has(k string) bool
Purpose
Execute has on &StrStr.
Parameters
m &StrStr- The
StrStr instance used by this call (borrow).
k string- key or index (string)
Returns
bool — true or false
(&StrInt) get
pub fn (m &StrInt) get(k string) int
Purpose
Execute get on &StrInt. Throws on failure; handle the error or propagate it to the caller.
Parameters
m &StrInt- The
StrInt instance used by this call (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
Execute get on &StrStr. Throws on failure; handle the error or propagate it to the caller.
Parameters
m &StrStr- The
StrStr instance used by this call (borrow).
k string- key or index (string)
Returns
string — result string
($&StrInt) del
pub fn (m $&StrInt) del(k string)
Purpose
Delete the entry matching the given key or identifier.
Parameters
m $&StrInt- The
StrInt instance used by this call (exclusive borrow).
k string- key or index (string)
Returns
This call does not return a value.
($&StrStr) del
pub fn (m $&StrStr) del(k string)
Purpose
Delete the entry matching the given key or identifier.
Parameters
m $&StrStr- The
StrStr instance used by this call (exclusive borrow).
k string- key or index (string)
Returns
This call does not return a value.
($&StrInt) clear
pub fn (m $&StrInt) clear()
Purpose
Clear all buffered or stored entries and internal state.
Parameters
m $&StrInt- The
StrInt instance used by this call (exclusive borrow).
Returns
This call does not return a value.
($&StrStr) clear
pub fn (m $&StrStr) clear()
Purpose
Clear all buffered or stored entries and internal state.
Parameters
m $&StrStr- The
StrStr instance used by this call (exclusive borrow).
Returns
This call does not return a value.
(&StrInt) len
pub fn (m &StrInt) len() int
Purpose
Operation on &StrInt: return the length.
Parameters
m &StrInt- The
StrInt instance used by this call (borrow).
Returns
int — a value of this type
(&StrStr) len
pub fn (m &StrStr) len() int
Purpose
Operation on &StrStr: return the length.
Parameters
m &StrStr- The
StrStr instance used by this call (borrow).
Returns
int — a value of this type
(&StrInt) keys
pub fn (m &StrInt) keys() []string
Purpose
Execute keys on &StrInt.
Parameters
m &StrInt- The
StrInt instance used by this call (borrow).
Returns
[]string — slice result
(&StrStr) keys
pub fn (m &StrStr) keys() []string
Purpose
Execute keys on &StrStr.
Parameters
m &StrStr- The
StrStr instance used by this call (borrow).
Returns
[]string — slice result
(&StrInt) values
pub fn (m &StrInt) values() []int
Purpose
Return a slice containing all values in the collection.
Parameters
m &StrInt- The
StrInt instance used by this call (borrow).
Returns
[]int — slice result
(&StrStr) values
pub fn (m &StrStr) values() []string
Purpose
Return a slice containing all values in the collection.
Parameters
m &StrStr- The
StrStr instance used by this call (borrow).
Returns
[]string — slice result
(&StrInt) clone
pub fn (m &StrInt) clone() StrInt
Purpose
Operation on &StrInt: copy into a new independent string.
Parameters
m &StrInt- The
StrInt instance used by this call (borrow).
Returns
StrInt — a value of this type
(&StrStr) clone
pub fn (m &StrStr) clone() StrStr
Purpose
Operation on &StrStr: copy into a new independent string.
Parameters
m &StrStr- The
StrStr instance used by this call (borrow).
Returns
StrStr — a value of this type
(&StrInt) equal
pub fn (m &StrInt) equal(o &StrInt) bool
Purpose
Operation on &StrInt: report whether the two values are equal.
Parameters
m &StrInt- The
StrInt instance used by this call (borrow).
o &StrInt- o (read-only borrow; caller keeps the original; type &StrInt)
Returns
bool — true or false
(&StrStr) equal
pub fn (m &StrStr) equal(o &StrStr) bool
Purpose
Operation on &StrStr: report whether the two values are equal.
Parameters
m &StrStr- The
StrStr instance used by this call (borrow).
o &StrStr- o (read-only borrow; caller keeps the original; type &StrStr)
Returns
bool — true or false
copy_str_int
pub fn copy_str_int(dst $&StrInt, src &StrInt)
Purpose
Copy str int.
Parameters
dst $&StrInt- destination (exclusive borrow; may modify the original; type $&StrInt)
src &StrInt- source (read-only borrow; caller keeps the original; type &StrInt)
Returns
This call does not return a value.
copy_str_str
pub fn copy_str_str(dst $&StrStr, src &StrStr)
Purpose
Copy str str.
Parameters
dst $&StrStr- destination (exclusive borrow; may modify the original; type $&StrStr)
src &StrStr- source (read-only borrow; caller keeps the original; type &StrStr)
Returns
This call does not return a value.
($&StrInt) delete_func
pub fn (m $&StrInt) delete_func(f fn(string, int) bool)
Purpose
Operation on $&StrInt: delete callback.
Parameters
m $&StrInt- The
StrInt instance used by this call (exclusive borrow).
f fn(string, int) bool- Callback with signature
fn(string, int) bool; pass the function value for this operation to invoke.
Returns
This call does not return a value.
($&StrStr) delete_func
pub fn (m $&StrStr) delete_func(f fn(string, string) bool)
Purpose
Operation on $&StrStr: delete callback.
Parameters
m $&StrStr- The
StrStr instance used by this call (exclusive borrow).
f fn(string, string) bool- Callback with signature
fn(string, string) bool; pass the function value for this operation to invoke.
Returns
This call does not return a value.