@shd101wyy/yo 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/skills/yo-async-effects/SKILL.md +4 -4
- package/.github/skills/yo-async-effects/async-effects-recipes.md +34 -34
- package/.github/skills/yo-core-patterns/SKILL.md +1 -1
- package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +26 -26
- package/.github/skills/yo-project-workflow/SKILL.md +6 -3
- package/.github/skills/yo-project-workflow/workflow-cheatsheet.md +34 -11
- package/.github/skills/yo-syntax/SKILL.md +7 -6
- package/.github/skills/yo-syntax/syntax-cheatsheet.md +73 -60
- package/.github/skills/yo-wasm-integration/wasm-integration-cheatsheet.md +3 -3
- package/README.md +10 -8
- package/out/cjs/index.cjs +456 -438
- package/out/cjs/yo-cli.cjs +576 -543
- package/out/cjs/yo-lsp.cjs +559 -532
- package/out/esm/index.mjs +281 -263
- package/out/types/src/formatter.d.ts +11 -0
- package/out/types/src/lsp/formatting.d.ts +2 -0
- package/out/types/src/tests/formatter.test.d.ts +1 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/alg/hash.yo +13 -21
- package/std/allocator.yo +25 -40
- package/std/async.yo +3 -7
- package/std/build.yo +105 -151
- package/std/cli/arg_parser.yo +184 -169
- package/std/collections/array_list.yo +350 -314
- package/std/collections/btree_map.yo +142 -131
- package/std/collections/deque.yo +132 -128
- package/std/collections/hash_map.yo +542 -566
- package/std/collections/hash_set.yo +623 -687
- package/std/collections/linked_list.yo +275 -293
- package/std/collections/ordered_map.yo +113 -85
- package/std/collections/priority_queue.yo +73 -73
- package/std/crypto/md5.yo +191 -95
- package/std/crypto/random.yo +56 -64
- package/std/crypto/sha256.yo +151 -107
- package/std/encoding/base64.yo +87 -81
- package/std/encoding/hex.yo +43 -50
- package/std/encoding/html.yo +56 -81
- package/std/encoding/html_char_utils.yo +7 -13
- package/std/encoding/html_entities.yo +2248 -2253
- package/std/encoding/json.yo +316 -224
- package/std/encoding/punycode.yo +86 -116
- package/std/encoding/toml.yo +67 -66
- package/std/encoding/utf16.yo +37 -44
- package/std/env.yo +62 -91
- package/std/error.yo +7 -15
- package/std/fmt/display.yo +5 -9
- package/std/fmt/index.yo +8 -14
- package/std/fmt/to_string.yo +330 -315
- package/std/fmt/writer.yo +58 -87
- package/std/fs/dir.yo +83 -102
- package/std/fs/file.yo +147 -180
- package/std/fs/metadata.yo +45 -78
- package/std/fs/temp.yo +55 -65
- package/std/fs/types.yo +27 -40
- package/std/fs/walker.yo +53 -68
- package/std/gc.yo +5 -8
- package/std/glob.yo +30 -43
- package/std/http/client.yo +107 -120
- package/std/http/http.yo +106 -96
- package/std/http/index.yo +4 -6
- package/std/imm/list.yo +88 -93
- package/std/imm/map.yo +528 -464
- package/std/imm/set.yo +52 -57
- package/std/imm/sorted_map.yo +340 -286
- package/std/imm/sorted_set.yo +57 -63
- package/std/imm/string.yo +404 -345
- package/std/imm/vec.yo +173 -181
- package/std/io/reader.yo +3 -6
- package/std/io/writer.yo +4 -8
- package/std/libc/assert.yo +5 -9
- package/std/libc/ctype.yo +32 -22
- package/std/libc/dirent.yo +26 -25
- package/std/libc/errno.yo +164 -90
- package/std/libc/fcntl.yo +52 -45
- package/std/libc/float.yo +66 -44
- package/std/libc/limits.yo +42 -33
- package/std/libc/math.yo +53 -82
- package/std/libc/signal.yo +72 -47
- package/std/libc/stdatomic.yo +217 -188
- package/std/libc/stdint.yo +5 -29
- package/std/libc/stdio.yo +5 -29
- package/std/libc/stdlib.yo +32 -39
- package/std/libc/string.yo +5 -23
- package/std/libc/sys/stat.yo +58 -56
- package/std/libc/time.yo +5 -19
- package/std/libc/unistd.yo +5 -20
- package/std/libc/wctype.yo +6 -9
- package/std/libc/windows.yo +26 -30
- package/std/log.yo +41 -55
- package/std/net/addr.yo +102 -97
- package/std/net/dns.yo +27 -28
- package/std/net/errors.yo +50 -49
- package/std/net/tcp.yo +113 -124
- package/std/net/udp.yo +55 -66
- package/std/os/env.yo +35 -33
- package/std/os/signal.yo +15 -25
- package/std/path.yo +276 -311
- package/std/prelude.yo +6304 -4315
- package/std/process/command.yo +87 -103
- package/std/process/index.yo +12 -31
- package/std/regex/compiler.yo +196 -95
- package/std/regex/flags.yo +58 -39
- package/std/regex/index.yo +157 -173
- package/std/regex/match.yo +20 -31
- package/std/regex/node.yo +134 -152
- package/std/regex/parser.yo +283 -259
- package/std/regex/unicode.yo +172 -202
- package/std/regex/vm.yo +155 -171
- package/std/string/index.yo +5 -7
- package/std/string/rune.yo +45 -55
- package/std/string/string.yo +937 -964
- package/std/string/string_builder.yo +94 -104
- package/std/string/unicode.yo +46 -64
- package/std/sync/channel.yo +72 -73
- package/std/sync/cond.yo +31 -36
- package/std/sync/mutex.yo +30 -32
- package/std/sync/once.yo +13 -16
- package/std/sync/rwlock.yo +26 -31
- package/std/sync/waitgroup.yo +20 -25
- package/std/sys/advise.yo +16 -24
- package/std/sys/bufio/buf_reader.yo +77 -93
- package/std/sys/bufio/buf_writer.yo +52 -65
- package/std/sys/clock.yo +4 -9
- package/std/sys/constants.yo +77 -61
- package/std/sys/copy.yo +4 -10
- package/std/sys/dir.yo +26 -43
- package/std/sys/dns.yo +41 -61
- package/std/sys/errors.yo +95 -103
- package/std/sys/events.yo +45 -57
- package/std/sys/externs.yo +319 -267
- package/std/sys/fallocate.yo +7 -11
- package/std/sys/fcntl.yo +14 -22
- package/std/sys/file.yo +26 -40
- package/std/sys/future.yo +5 -8
- package/std/sys/iov.yo +12 -25
- package/std/sys/lock.yo +12 -13
- package/std/sys/mmap.yo +38 -43
- package/std/sys/path.yo +3 -8
- package/std/sys/perm.yo +7 -21
- package/std/sys/pipe.yo +5 -12
- package/std/sys/process.yo +23 -29
- package/std/sys/seek.yo +10 -12
- package/std/sys/signal.yo +7 -13
- package/std/sys/signals.yo +52 -35
- package/std/sys/socket.yo +63 -58
- package/std/sys/socketpair.yo +3 -6
- package/std/sys/sockinfo.yo +11 -20
- package/std/sys/statfs.yo +11 -34
- package/std/sys/statx.yo +25 -52
- package/std/sys/sysinfo.yo +15 -20
- package/std/sys/tcp.yo +62 -92
- package/std/sys/temp.yo +5 -9
- package/std/sys/time.yo +5 -15
- package/std/sys/timer.yo +6 -11
- package/std/sys/tty.yo +10 -18
- package/std/sys/udp.yo +22 -39
- package/std/sys/umask.yo +3 -6
- package/std/sys/unix.yo +33 -52
- package/std/testing/bench.yo +49 -52
- package/std/thread.yo +10 -15
- package/std/time/datetime.yo +105 -89
- package/std/time/duration.yo +43 -56
- package/std/time/instant.yo +13 -18
- package/std/time/sleep.yo +5 -9
- package/std/url/index.yo +184 -209
- package/std/worker.yo +6 -10
package/std/collections/deque.yo
CHANGED
|
@@ -10,92 +10,87 @@
|
|
|
10
10
|
//! d.push_front(0);
|
|
11
11
|
//! x := d.pop_front().unwrap(); // 0
|
|
12
12
|
//! ```
|
|
13
|
-
|
|
14
|
-
{ GlobalAllocator, AllocError } :: import "../allocator";
|
|
13
|
+
{ GlobalAllocator, AllocError } :: import("../allocator");
|
|
15
14
|
{ malloc, realloc, free } :: GlobalAllocator;
|
|
16
|
-
|
|
17
15
|
/// Circular buffer supporting efficient push/pop at both front and back.
|
|
18
16
|
Deque :: (fn(comptime(T) : Type) -> comptime(Type))(
|
|
19
17
|
object(
|
|
20
|
-
_buf
|
|
21
|
-
_head
|
|
22
|
-
_tail
|
|
23
|
-
_len
|
|
18
|
+
_buf : ?*(T),
|
|
19
|
+
_head : usize,
|
|
20
|
+
_tail : usize,
|
|
21
|
+
_len : usize,
|
|
24
22
|
_capacity : usize
|
|
25
23
|
)
|
|
26
24
|
);
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
impl(
|
|
26
|
+
forall(T : Type),
|
|
27
|
+
Deque(T),
|
|
29
28
|
// Create an empty Deque.
|
|
30
29
|
new : (fn() -> Self)(
|
|
31
|
-
Self(_buf
|
|
30
|
+
Self(_buf :.None, _head : usize(0), _tail : usize(0), _len : usize(0), _capacity : usize(0))
|
|
32
31
|
),
|
|
33
|
-
|
|
34
32
|
// Number of elements currently stored.
|
|
35
|
-
len : (fn(self: Self) -> usize)(
|
|
33
|
+
len : (fn(self : Self) -> usize)(
|
|
36
34
|
self._len
|
|
37
35
|
),
|
|
38
|
-
|
|
39
36
|
// True if the deque contains no elements.
|
|
40
|
-
is_empty : (fn(self: Self) -> bool)(
|
|
41
|
-
|
|
37
|
+
is_empty : (fn(self : Self) -> bool)(
|
|
38
|
+
self._len == usize(0)
|
|
42
39
|
),
|
|
43
|
-
|
|
44
40
|
// Ensure at least `min_cap` slots are available.
|
|
45
|
-
_grow : (fn(self: Self, min_cap: usize) -> unit)({
|
|
41
|
+
_grow : (fn(self : Self, min_cap : usize) -> unit)({
|
|
46
42
|
new_cap := cond(
|
|
47
43
|
(self._capacity == usize(0)) => usize(8),
|
|
48
44
|
true => (self._capacity * usize(2))
|
|
49
45
|
);
|
|
50
|
-
while
|
|
46
|
+
while(new_cap < min_cap, new_cap = (new_cap * usize(2)), ());
|
|
51
47
|
size := (new_cap * sizeof(T));
|
|
52
48
|
new_buf := *(T)(malloc(size).unwrap());
|
|
53
49
|
// Linearise existing elements into the new buffer
|
|
54
50
|
i := usize(0);
|
|
55
|
-
while
|
|
51
|
+
while(i < self._len, i = (i + usize(1)), {
|
|
56
52
|
idx := ((self._head + i) % self._capacity);
|
|
57
53
|
buf := self._buf.unwrap();
|
|
58
54
|
consume((new_buf &+ i).* = (buf &+ idx).*);
|
|
59
|
-
};
|
|
55
|
+
});
|
|
60
56
|
// Drop old elements for RC types before freeing old buffer
|
|
61
57
|
// (the copy above duped each element, so old slots still hold references)
|
|
62
58
|
cond(
|
|
63
59
|
Type.contains_rc_type(T) => {
|
|
64
60
|
j := usize(0);
|
|
65
|
-
while
|
|
61
|
+
while(j < self._len, j = (j + usize(1)), {
|
|
66
62
|
old_idx := ((self._head + j) % self._capacity);
|
|
67
63
|
old_buf := self._buf.unwrap();
|
|
68
64
|
unsafe.drop((old_buf &+ old_idx).*);
|
|
69
|
-
};
|
|
65
|
+
});
|
|
70
66
|
},
|
|
71
67
|
true => ()
|
|
72
68
|
);
|
|
73
|
-
match(
|
|
69
|
+
match(
|
|
70
|
+
self._buf,
|
|
74
71
|
.Some(p) => free(.Some(*(void)(p))),
|
|
75
|
-
.None
|
|
72
|
+
.None => ()
|
|
76
73
|
);
|
|
77
|
-
self._buf
|
|
78
|
-
self._head
|
|
79
|
-
self._tail
|
|
74
|
+
self._buf =.Some(new_buf);
|
|
75
|
+
self._head = usize(0);
|
|
76
|
+
self._tail = self._len;
|
|
80
77
|
self._capacity = new_cap;
|
|
81
78
|
}),
|
|
82
|
-
|
|
83
79
|
// Push an element to the back.
|
|
84
|
-
push_back : (fn(self: Self, val: T) -> unit)({
|
|
80
|
+
push_back : (fn(self : Self, val : T) -> unit)({
|
|
85
81
|
cond(
|
|
86
|
-
(self._len == self._capacity) => self._grow(
|
|
82
|
+
(self._len == self._capacity) => self._grow(self._len + usize(1)),
|
|
87
83
|
true => ()
|
|
88
84
|
);
|
|
89
85
|
buf := self._buf.unwrap();
|
|
90
86
|
consume((buf &+ self._tail).* = val);
|
|
91
87
|
self._tail = ((self._tail + usize(1)) % self._capacity);
|
|
92
|
-
self._len
|
|
88
|
+
self._len = (self._len + usize(1));
|
|
93
89
|
}),
|
|
94
|
-
|
|
95
90
|
// Push an element to the front.
|
|
96
|
-
push_front : (fn(self: Self, val: T) -> unit)({
|
|
91
|
+
push_front : (fn(self : Self, val : T) -> unit)({
|
|
97
92
|
cond(
|
|
98
|
-
(self._len == self._capacity) => self._grow(
|
|
93
|
+
(self._len == self._capacity) => self._grow(self._len + usize(1)),
|
|
99
94
|
true => ()
|
|
100
95
|
);
|
|
101
96
|
self._head = cond(
|
|
@@ -106,27 +101,25 @@ impl(forall(T : Type), Deque(T),
|
|
|
106
101
|
consume((buf &+ self._head).* = val);
|
|
107
102
|
self._len = (self._len + usize(1));
|
|
108
103
|
}),
|
|
109
|
-
|
|
110
104
|
// Remove and return the front element.
|
|
111
|
-
pop_front : (fn(self: Self) -> ?T)(
|
|
105
|
+
pop_front : (fn(self : Self) -> ?(T))(
|
|
112
106
|
cond(
|
|
113
|
-
(self._len == usize(0))
|
|
107
|
+
(self._len == usize(0)) =>.None,
|
|
114
108
|
true => {
|
|
115
109
|
buf := self._buf.unwrap();
|
|
116
110
|
element_ptr := (buf &+ self._head);
|
|
117
111
|
val := element_ptr.*;
|
|
118
112
|
unsafe.drop(element_ptr.*);
|
|
119
113
|
self._head = ((self._head + usize(1)) % self._capacity);
|
|
120
|
-
self._len
|
|
114
|
+
self._len = (self._len - usize(1));
|
|
121
115
|
.Some(val)
|
|
122
116
|
}
|
|
123
117
|
)
|
|
124
118
|
),
|
|
125
|
-
|
|
126
119
|
// Remove and return the back element.
|
|
127
|
-
pop_back : (fn(self: Self) -> ?T)(
|
|
120
|
+
pop_back : (fn(self : Self) -> ?(T))(
|
|
128
121
|
cond(
|
|
129
|
-
(self._len == usize(0))
|
|
122
|
+
(self._len == usize(0)) =>.None,
|
|
130
123
|
true => {
|
|
131
124
|
self._tail = cond(
|
|
132
125
|
(self._tail == usize(0)) => (self._capacity - usize(1)),
|
|
@@ -141,11 +134,10 @@ impl(forall(T : Type), Deque(T),
|
|
|
141
134
|
}
|
|
142
135
|
)
|
|
143
136
|
),
|
|
144
|
-
|
|
145
137
|
// Get an element by logical index (0 = front).
|
|
146
|
-
get : (fn(self: Self, index: usize) -> ?T)(
|
|
138
|
+
get : (fn(self : Self, index : usize) -> ?(T))(
|
|
147
139
|
cond(
|
|
148
|
-
(index >= self._len)
|
|
140
|
+
(index >= self._len) =>.None,
|
|
149
141
|
true => {
|
|
150
142
|
buf := self._buf.unwrap();
|
|
151
143
|
idx := ((self._head + index) % self._capacity);
|
|
@@ -154,112 +146,124 @@ impl(forall(T : Type), Deque(T),
|
|
|
154
146
|
)
|
|
155
147
|
)
|
|
156
148
|
);
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
)
|
|
179
|
-
|
|
149
|
+
impl(
|
|
150
|
+
forall(T : Type),
|
|
151
|
+
Deque(T),
|
|
152
|
+
Dispose(
|
|
153
|
+
dispose : (fn(self : Self) -> unit)({
|
|
154
|
+
match(
|
|
155
|
+
self._buf,
|
|
156
|
+
.Some(p) => {
|
|
157
|
+
cond(
|
|
158
|
+
Type.contains_rc_type(T) => {
|
|
159
|
+
i := usize(0);
|
|
160
|
+
while(i < self._len, i = (i + usize(1)), {
|
|
161
|
+
idx := ((self._head + i) % self._capacity);
|
|
162
|
+
unsafe.drop((p &+ idx).*);
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
true => ()
|
|
166
|
+
);
|
|
167
|
+
free(.Some(*(void)(p)));
|
|
168
|
+
self._buf =.None;
|
|
169
|
+
},
|
|
170
|
+
.None => ()
|
|
171
|
+
);
|
|
172
|
+
})
|
|
173
|
+
)
|
|
174
|
+
);
|
|
180
175
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
176
|
+
* Value iterator for Deque - yields elements by value (T)
|
|
177
|
+
* Traverses the circular buffer in logical order.
|
|
178
|
+
*/
|
|
184
179
|
DequeIter :: (fn(comptime(T) : Type) -> comptime(Type))(
|
|
185
180
|
struct(
|
|
186
|
-
_deque
|
|
187
|
-
_pos
|
|
181
|
+
_deque : Deque(T),
|
|
182
|
+
_pos : usize,
|
|
188
183
|
_remaining : usize
|
|
189
184
|
)
|
|
190
185
|
);
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
186
|
+
impl(
|
|
187
|
+
forall(T : Type),
|
|
188
|
+
DequeIter(T),
|
|
189
|
+
Iterator(
|
|
190
|
+
Item : T,
|
|
191
|
+
next : (fn(self : *(Self)) -> Option(T))(
|
|
192
|
+
cond(
|
|
193
|
+
(self._remaining == usize(0)) =>.None,
|
|
194
|
+
true => {
|
|
195
|
+
idx := ((self._deque._head + self._pos) % self._deque._capacity);
|
|
196
|
+
buf := self._deque._buf.unwrap();
|
|
197
|
+
value := (buf &+ idx).*;
|
|
198
|
+
self._pos = (self._pos + usize(1));
|
|
199
|
+
self._remaining = (self._remaining - usize(1));
|
|
200
|
+
.Some(value)
|
|
201
|
+
}
|
|
202
|
+
)
|
|
205
203
|
)
|
|
206
204
|
)
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
);
|
|
206
|
+
impl(
|
|
207
|
+
forall(T : Type),
|
|
208
|
+
Deque(T),
|
|
210
209
|
into_iter : (fn(self : Self) -> DequeIter(T))(
|
|
211
|
-
DequeIter(T)(_deque: self, _pos: usize(0), _remaining: self._len)
|
|
210
|
+
DequeIter(T)(_deque : self, _pos : usize(0), _remaining : self._len)
|
|
212
211
|
)
|
|
213
212
|
);
|
|
214
|
-
|
|
215
213
|
/**
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
214
|
+
* Pointer iterator for Deque - yields pointers to elements (*(T))
|
|
215
|
+
* Yields pointers into the circular buffer. Pointers are valid as long as
|
|
216
|
+
* the deque is not modified during iteration.
|
|
217
|
+
*/
|
|
220
218
|
DequeIterPtr :: (fn(comptime(T) : Type) -> comptime(Type))(
|
|
221
219
|
struct(
|
|
222
|
-
_deque
|
|
223
|
-
_pos
|
|
220
|
+
_deque : Deque(T),
|
|
221
|
+
_pos : usize,
|
|
224
222
|
_remaining : usize
|
|
225
223
|
)
|
|
226
224
|
);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
225
|
+
impl(
|
|
226
|
+
forall(T : Type),
|
|
227
|
+
DequeIterPtr(T),
|
|
228
|
+
Iterator(
|
|
229
|
+
Item : *(T),
|
|
230
|
+
next : (fn(self : *(Self)) -> Option(*(T)))(
|
|
231
|
+
cond(
|
|
232
|
+
(self._remaining == usize(0)) =>.None,
|
|
233
|
+
true => {
|
|
234
|
+
idx := ((self._deque._head + self._pos) % self._deque._capacity);
|
|
235
|
+
buf := self._deque._buf.unwrap();
|
|
236
|
+
element_ptr := (buf &+ idx);
|
|
237
|
+
self._pos = (self._pos + usize(1));
|
|
238
|
+
self._remaining = (self._remaining - usize(1));
|
|
239
|
+
.Some(element_ptr)
|
|
240
|
+
}
|
|
241
|
+
)
|
|
241
242
|
)
|
|
242
243
|
)
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
);
|
|
245
|
+
impl(
|
|
246
|
+
forall(T : Type),
|
|
247
|
+
Deque(T),
|
|
246
248
|
iter : (fn(self : *(Self)) -> DequeIterPtr(T))(
|
|
247
|
-
DequeIterPtr(T)(_deque: self.*, _pos: usize(0), _remaining: self.*._len)
|
|
249
|
+
DequeIterPtr(T)(_deque : self.*, _pos : usize(0), _remaining : self.*._len)
|
|
248
250
|
)
|
|
249
251
|
);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
252
|
+
impl(
|
|
253
|
+
forall(T : Type),
|
|
254
|
+
Deque(T),
|
|
255
|
+
Index(usize)(
|
|
256
|
+
Output : T,
|
|
257
|
+
index : (fn(self : *(Self), idx : usize) -> *(Self.Output))({
|
|
258
|
+
assert(idx < self.*._len, "Deque: index out of bounds");
|
|
259
|
+
buf := self.*._buf.unwrap();
|
|
260
|
+
physical_idx := ((self.*._head + idx) % self.*._capacity);
|
|
261
|
+
buf &+ physical_idx
|
|
262
|
+
})
|
|
263
|
+
)
|
|
264
|
+
);
|
|
265
|
+
export(
|
|
262
266
|
Deque,
|
|
263
267
|
DequeIter,
|
|
264
268
|
DequeIterPtr
|
|
265
|
-
;
|
|
269
|
+
);
|