XU XUv0.16.0

#container/ring

import: #container/ring

counts: 9 functions, 4 methods, 1 types, 0 constants, 0 method sets

Ring list; values are owning strings.

struct Ring

XuAPI
pub struct Ring {
    pub val []string
    pub next []int
    pub prev []int
    pub cur int
}

Purpose

Structure encapsulating val, next, prev, cur.

Public fields

val []string
value
next []int
field ([]int)
prev []int
field ([]int)
cur int
field (int)

new

XuAPI
pub fn new(n int) Ring

Purpose

Construct a new value of this type.

Parameters

n int
count, length, or limit (int)

Returns

Ring — a value of this type

len

XuAPI
pub fn len(r &Ring) int

Purpose

Return the length.

Parameters

r &Ring
rune (Unicode code point) (read-only borrow; caller keeps the original; type &Ring)

Returns

int — a value of this type

next

XuAPI
pub fn next(r &Ring, e int) int

Purpose

Take the next item, or end according to this type.

Parameters

r &Ring
rune (Unicode code point) (read-only borrow; caller keeps the original; type &Ring)
e int
e (int)

Returns

int — a value of this type

prev

XuAPI
pub fn prev(r &Ring, e int) int

Purpose

Execute prev.

Parameters

r &Ring
rune (Unicode code point) (read-only borrow; caller keeps the original; type &Ring)
e int
e (int)

Returns

int — a value of this type

move

XuAPI
pub fn move(r &Ring, e int, n int) int

Purpose

Execute move.

Parameters

r &Ring
rune (Unicode code point) (read-only borrow; caller keeps the original; type &Ring)
e int
e (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

value

XuAPI
pub fn value(r &Ring, e int) string

Purpose

Execute value.

Parameters

r &Ring
rune (Unicode code point) (read-only borrow; caller keeps the original; type &Ring)
e int
e (int)

Returns

string — result string

($&Ring) set_value

XuAPI
pub fn (r $&Ring) set_value(e int, v string)

Purpose

Operation on $&Ring: set value.

Parameters

r $&Ring
The Ring instance used by this call (exclusive borrow).
e int
e (int)
v string
value (string)

Returns

This call does not return a value.

cur

XuAPI
pub fn cur(r &Ring) int

Purpose

Return the current element value or index of the ring.

Parameters

r &Ring
rune (Unicode code point) (read-only borrow; caller keeps the original; type &Ring)

Returns

int — a value of this type

($&Ring) set_cur

XuAPI
pub fn (r $&Ring) set_cur(e int)

Purpose

Operation on $&Ring: set cur.

Parameters

r $&Ring
The Ring instance used by this call (exclusive borrow).
e int
e (int)

Returns

This call does not return a value.

values

XuAPI
pub fn values(r &Ring) []string

Purpose

Execute values.

Parameters

r &Ring
rune (Unicode code point) (read-only borrow; caller keeps the original; type &Ring)

Returns

[]string — slice result

do

XuAPI
pub fn do(r &Ring, f fn(string))

Purpose

Do visits each element once, clockwise from cur.

Parameters

r &Ring
rune (Unicode code point) (read-only borrow; caller keeps the original; type &Ring)
f fn(string)
Callback with signature fn(string); pass the function value for this operation to invoke.

Returns

This call does not return a value.