#container/list
Xu 0.16.0 API
import: #container/list
counts: 7 functions, 10 methods, 1 types, 0 constants, 0 method sets
Doubly linked list; values are owning strings.
struct List
pub struct List {
pub val []string
pub next []int
pub prev []int
pub len int
pub free int
}
Purpose
Structure encapsulating val, next, prev, len, free.
Public fields
val []string- value
next []int- field ([]int)
prev []int- field ([]int)
len int- field (int)
free int- field (int)
($&List) init
Purpose
Initialize internal state and default parameters.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
Returns
This call does not return a value.
new
Purpose
Construct a new value of this type.
Parameters
No arguments are required.
Returns
List — a value of this type
($&List) push_back
pub fn (l $&List) push_back(v string) int
Purpose
Operation on $&List: push back.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
v string- value (string)
Returns
int — a value of this type
($&List) push_front
pub fn (l $&List) push_front(v string) int
Purpose
Operation on $&List: push front.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
v string- value (string)
Returns
int — a value of this type
($&List) insert_after
pub fn (l $&List) insert_after(e int, v string) int
Purpose
Operation on $&List: insert after.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
e int- e (int)
v string- value (string)
Returns
int — a value of this type
($&List) insert_before
pub fn (l $&List) insert_before(e int, v string) int
Purpose
Operation on $&List: insert before.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
e int- e (int)
v string- value (string)
Returns
int — a value of this type
($&List) remove
pub fn (l $&List) remove(e int) string
Purpose
Operation on $&List: remove.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
e int- e (int)
Returns
string — result string
($&List) move_to_front
pub fn (l $&List) move_to_front(e int)
Purpose
Operation on $&List: move to front.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
e int- e (int)
Returns
This call does not return a value.
($&List) move_to_back
pub fn (l $&List) move_to_back(e int)
Purpose
Operation on $&List: move to back.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
e int- e (int)
Returns
This call does not return a value.
($&List) move_after
pub fn (l $&List) move_after(e int, mark int)
Purpose
Operation on $&List: move after.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
e int- e (int)
mark int- mark (int)
Returns
This call does not return a value.
($&List) move_before
pub fn (l $&List) move_before(e int, mark int)
Purpose
Operation on $&List: move before.
Parameters
l $&List- The
List instance used by this call (exclusive borrow).
e int- e (int)
mark int- mark (int)
Returns
This call does not return a value.
len
Purpose
Return the length.
Parameters
l &List- l (read-only borrow; caller keeps the original; type &List)
Returns
int — a value of this type
front
pub fn front(l &List) int
Purpose
Execute front.
Parameters
l &List- l (read-only borrow; caller keeps the original; type &List)
Returns
int — a value of this type
back
Purpose
Execute back.
Parameters
l &List- l (read-only borrow; caller keeps the original; type &List)
Returns
int — a value of this type
next
pub fn next(l &List, e int) int
Purpose
Take the next item, or end according to this type.
Parameters
l &List- l (read-only borrow; caller keeps the original; type &List)
e int- e (int)
Returns
int — a value of this type
prev
pub fn prev(l &List, e int) int
Purpose
Execute prev.
Parameters
l &List- l (read-only borrow; caller keeps the original; type &List)
e int- e (int)
Returns
int — a value of this type
value
pub fn value(l &List, e int) string
Purpose
Execute value.
Parameters
l &List- l (read-only borrow; caller keeps the original; type &List)
e int- e (int)
Returns
string — result string