@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.
Files changed (167) hide show
  1. package/.github/skills/yo-async-effects/SKILL.md +4 -4
  2. package/.github/skills/yo-async-effects/async-effects-recipes.md +34 -34
  3. package/.github/skills/yo-core-patterns/SKILL.md +1 -1
  4. package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +26 -26
  5. package/.github/skills/yo-project-workflow/SKILL.md +6 -3
  6. package/.github/skills/yo-project-workflow/workflow-cheatsheet.md +34 -11
  7. package/.github/skills/yo-syntax/SKILL.md +7 -6
  8. package/.github/skills/yo-syntax/syntax-cheatsheet.md +73 -60
  9. package/.github/skills/yo-wasm-integration/wasm-integration-cheatsheet.md +3 -3
  10. package/README.md +10 -8
  11. package/out/cjs/index.cjs +456 -438
  12. package/out/cjs/yo-cli.cjs +576 -543
  13. package/out/cjs/yo-lsp.cjs +559 -532
  14. package/out/esm/index.mjs +281 -263
  15. package/out/types/src/formatter.d.ts +11 -0
  16. package/out/types/src/lsp/formatting.d.ts +2 -0
  17. package/out/types/src/tests/formatter.test.d.ts +1 -0
  18. package/out/types/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +1 -1
  20. package/std/alg/hash.yo +13 -21
  21. package/std/allocator.yo +25 -40
  22. package/std/async.yo +3 -7
  23. package/std/build.yo +105 -151
  24. package/std/cli/arg_parser.yo +184 -169
  25. package/std/collections/array_list.yo +350 -314
  26. package/std/collections/btree_map.yo +142 -131
  27. package/std/collections/deque.yo +132 -128
  28. package/std/collections/hash_map.yo +542 -566
  29. package/std/collections/hash_set.yo +623 -687
  30. package/std/collections/linked_list.yo +275 -293
  31. package/std/collections/ordered_map.yo +113 -85
  32. package/std/collections/priority_queue.yo +73 -73
  33. package/std/crypto/md5.yo +191 -95
  34. package/std/crypto/random.yo +56 -64
  35. package/std/crypto/sha256.yo +151 -107
  36. package/std/encoding/base64.yo +87 -81
  37. package/std/encoding/hex.yo +43 -50
  38. package/std/encoding/html.yo +56 -81
  39. package/std/encoding/html_char_utils.yo +7 -13
  40. package/std/encoding/html_entities.yo +2248 -2253
  41. package/std/encoding/json.yo +316 -224
  42. package/std/encoding/punycode.yo +86 -116
  43. package/std/encoding/toml.yo +67 -66
  44. package/std/encoding/utf16.yo +37 -44
  45. package/std/env.yo +62 -91
  46. package/std/error.yo +7 -15
  47. package/std/fmt/display.yo +5 -9
  48. package/std/fmt/index.yo +8 -14
  49. package/std/fmt/to_string.yo +330 -315
  50. package/std/fmt/writer.yo +58 -87
  51. package/std/fs/dir.yo +83 -102
  52. package/std/fs/file.yo +147 -180
  53. package/std/fs/metadata.yo +45 -78
  54. package/std/fs/temp.yo +55 -65
  55. package/std/fs/types.yo +27 -40
  56. package/std/fs/walker.yo +53 -68
  57. package/std/gc.yo +5 -8
  58. package/std/glob.yo +30 -43
  59. package/std/http/client.yo +107 -120
  60. package/std/http/http.yo +106 -96
  61. package/std/http/index.yo +4 -6
  62. package/std/imm/list.yo +88 -93
  63. package/std/imm/map.yo +528 -464
  64. package/std/imm/set.yo +52 -57
  65. package/std/imm/sorted_map.yo +340 -286
  66. package/std/imm/sorted_set.yo +57 -63
  67. package/std/imm/string.yo +404 -345
  68. package/std/imm/vec.yo +173 -181
  69. package/std/io/reader.yo +3 -6
  70. package/std/io/writer.yo +4 -8
  71. package/std/libc/assert.yo +5 -9
  72. package/std/libc/ctype.yo +32 -22
  73. package/std/libc/dirent.yo +26 -25
  74. package/std/libc/errno.yo +164 -90
  75. package/std/libc/fcntl.yo +52 -45
  76. package/std/libc/float.yo +66 -44
  77. package/std/libc/limits.yo +42 -33
  78. package/std/libc/math.yo +53 -82
  79. package/std/libc/signal.yo +72 -47
  80. package/std/libc/stdatomic.yo +217 -188
  81. package/std/libc/stdint.yo +5 -29
  82. package/std/libc/stdio.yo +5 -29
  83. package/std/libc/stdlib.yo +32 -39
  84. package/std/libc/string.yo +5 -23
  85. package/std/libc/sys/stat.yo +58 -56
  86. package/std/libc/time.yo +5 -19
  87. package/std/libc/unistd.yo +5 -20
  88. package/std/libc/wctype.yo +6 -9
  89. package/std/libc/windows.yo +26 -30
  90. package/std/log.yo +41 -55
  91. package/std/net/addr.yo +102 -97
  92. package/std/net/dns.yo +27 -28
  93. package/std/net/errors.yo +50 -49
  94. package/std/net/tcp.yo +113 -124
  95. package/std/net/udp.yo +55 -66
  96. package/std/os/env.yo +35 -33
  97. package/std/os/signal.yo +15 -25
  98. package/std/path.yo +276 -311
  99. package/std/prelude.yo +6304 -4315
  100. package/std/process/command.yo +87 -103
  101. package/std/process/index.yo +12 -31
  102. package/std/regex/compiler.yo +196 -95
  103. package/std/regex/flags.yo +58 -39
  104. package/std/regex/index.yo +157 -173
  105. package/std/regex/match.yo +20 -31
  106. package/std/regex/node.yo +134 -152
  107. package/std/regex/parser.yo +283 -259
  108. package/std/regex/unicode.yo +172 -202
  109. package/std/regex/vm.yo +155 -171
  110. package/std/string/index.yo +5 -7
  111. package/std/string/rune.yo +45 -55
  112. package/std/string/string.yo +937 -964
  113. package/std/string/string_builder.yo +94 -104
  114. package/std/string/unicode.yo +46 -64
  115. package/std/sync/channel.yo +72 -73
  116. package/std/sync/cond.yo +31 -36
  117. package/std/sync/mutex.yo +30 -32
  118. package/std/sync/once.yo +13 -16
  119. package/std/sync/rwlock.yo +26 -31
  120. package/std/sync/waitgroup.yo +20 -25
  121. package/std/sys/advise.yo +16 -24
  122. package/std/sys/bufio/buf_reader.yo +77 -93
  123. package/std/sys/bufio/buf_writer.yo +52 -65
  124. package/std/sys/clock.yo +4 -9
  125. package/std/sys/constants.yo +77 -61
  126. package/std/sys/copy.yo +4 -10
  127. package/std/sys/dir.yo +26 -43
  128. package/std/sys/dns.yo +41 -61
  129. package/std/sys/errors.yo +95 -103
  130. package/std/sys/events.yo +45 -57
  131. package/std/sys/externs.yo +319 -267
  132. package/std/sys/fallocate.yo +7 -11
  133. package/std/sys/fcntl.yo +14 -22
  134. package/std/sys/file.yo +26 -40
  135. package/std/sys/future.yo +5 -8
  136. package/std/sys/iov.yo +12 -25
  137. package/std/sys/lock.yo +12 -13
  138. package/std/sys/mmap.yo +38 -43
  139. package/std/sys/path.yo +3 -8
  140. package/std/sys/perm.yo +7 -21
  141. package/std/sys/pipe.yo +5 -12
  142. package/std/sys/process.yo +23 -29
  143. package/std/sys/seek.yo +10 -12
  144. package/std/sys/signal.yo +7 -13
  145. package/std/sys/signals.yo +52 -35
  146. package/std/sys/socket.yo +63 -58
  147. package/std/sys/socketpair.yo +3 -6
  148. package/std/sys/sockinfo.yo +11 -20
  149. package/std/sys/statfs.yo +11 -34
  150. package/std/sys/statx.yo +25 -52
  151. package/std/sys/sysinfo.yo +15 -20
  152. package/std/sys/tcp.yo +62 -92
  153. package/std/sys/temp.yo +5 -9
  154. package/std/sys/time.yo +5 -15
  155. package/std/sys/timer.yo +6 -11
  156. package/std/sys/tty.yo +10 -18
  157. package/std/sys/udp.yo +22 -39
  158. package/std/sys/umask.yo +3 -6
  159. package/std/sys/unix.yo +33 -52
  160. package/std/testing/bench.yo +49 -52
  161. package/std/thread.yo +10 -15
  162. package/std/time/datetime.yo +105 -89
  163. package/std/time/duration.yo +43 -56
  164. package/std/time/instant.yo +13 -18
  165. package/std/time/sleep.yo +5 -9
  166. package/std/url/index.yo +184 -209
  167. package/std/worker.yo +6 -10
@@ -10,20 +10,15 @@
10
10
  //! m.set(String.from("a"), 1);
11
11
  //! // Iteration order: a, b
12
12
  //! ```
13
-
14
- { ArrayList } :: import "./array_list";
15
- open import "../string";
16
-
13
+ { ArrayList } :: import("./array_list");
14
+ open(import("../string"));
17
15
  /// Key-value pair entry stored in a BTreeMap.
18
16
  BTreeEntry :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
19
- struct(key: K, value: V)
17
+ struct(key : K, value : V)
20
18
  );
21
-
22
- export BTreeEntry;
23
-
19
+ export(BTreeEntry);
24
20
  // Internal result from binary search.
25
- _FindResult :: struct(idx: usize, found: bool);
26
-
21
+ _FindResult :: struct(idx : usize, found : bool);
27
22
  /// Sorted map maintaining entries in key order.
28
23
  /// Provides ordered iteration and O(log n) lookup via binary search. Insert is O(n).
29
24
  BTreeMap :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
@@ -31,74 +26,75 @@ BTreeMap :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
31
26
  _entries : ArrayList(BTreeEntry(K, V))
32
27
  )
33
28
  );
34
-
35
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
29
+ impl(
30
+ forall(K : Type, V : Type),
31
+ BTreeMap(K, V),
36
32
  // Create an empty map.
37
33
  new : (fn() -> Self)(
38
- Self(_entries: ArrayList(BTreeEntry(K, V)).new())
34
+ Self(_entries : ArrayList(BTreeEntry(K, V)).new())
39
35
  ),
40
-
41
36
  // Number of entries.
42
- len : (fn(self: Self) -> usize)(
37
+ len : (fn(self : Self) -> usize)(
43
38
  self._entries.len()
44
39
  ),
45
-
46
40
  // True if empty.
47
- is_empty : (fn(self: Self) -> bool)(
48
- (self._entries.len() == usize(0))
41
+ is_empty : (fn(self : Self) -> bool)(
42
+ self._entries.len() == usize(0)
49
43
  ),
50
-
51
44
  // Binary search: returns the index of the entry with key `k`,
52
45
  // or the insertion point if not found.
53
- _find : (fn(self: Self, k: K, where(K <: Ord(K))) -> _FindResult)({
46
+ _find : (fn(self : Self, k : K, where(K <: Ord(K))) -> _FindResult)({
54
47
  lo := usize(0);
55
48
  hi := self._entries.len();
56
- while (lo < hi), {
49
+ while(lo < hi, {
57
50
  mid := (lo + ((hi - lo) / usize(2)));
58
51
  entry_key := self._entries.get(mid).unwrap().key;
59
52
  cond(
60
- (entry_key < k) => { lo = (mid + usize(1)); },
61
- (entry_key > k) => { hi = mid; },
62
- true => { return _FindResult(mid, true); }
53
+ (entry_key < k) => {
54
+ lo = (mid + usize(1));
55
+ },
56
+ (entry_key > k) => {
57
+ hi = mid;
58
+ },
59
+ true => {
60
+ return(_FindResult(mid, true));
61
+ }
63
62
  );
64
- };
63
+ });
65
64
  _FindResult(lo, false)
66
65
  }),
67
-
68
66
  // Retrieve the value associated with key `k`.
69
- get : (fn(self: Self, k: K, where(K <: Ord(K))) -> ?V)({
67
+ get : (fn(self : Self, k : K, where(K <: Ord(K))) -> ?(V))({
70
68
  r := self._find(k);
71
69
  cond(
72
- r.found => .Some(self._entries.get(r.idx).unwrap().value),
73
- true => .None
70
+ r.found =>.Some(self._entries.get(r.idx).unwrap().value),
71
+ true =>.None
74
72
  )
75
73
  }),
76
-
77
74
  // Insert or update the value for key `k`.
78
75
  // For new keys: append at end then shift-left to correct sorted position.
79
- set : (fn(self: Self, k: K, v: V, where(K <: Ord(K))) -> unit)({
76
+ set : (fn(self : Self, k : K, v : V, where(K <: Ord(K))) -> unit)({
80
77
  r := self._find(k);
81
78
  cond(
82
79
  r.found => {
83
80
  entry := self._entries.get(r.idx).unwrap();
84
- &(self._entries(r.idx)).* = BTreeEntry(K, V)(key: entry.key, value: v);
81
+ &(self._entries(r.idx)).* = BTreeEntry(K, V)(key : entry.key, value : v);
85
82
  },
86
83
  true => {
87
84
  // Append new entry then bubble left to sorted position
88
- self._entries.push(BTreeEntry(K, V)(key: k, value: v));
85
+ self._entries.push(BTreeEntry(K, V)(key : k, value : v));
89
86
  pos := (self._entries.len() - usize(1));
90
- while (pos > r.idx), (pos = (pos - usize(1))), {
87
+ while(pos > r.idx, pos = (pos - usize(1)), {
91
88
  curr := self._entries.get(pos).unwrap();
92
- prev := self._entries.get((pos - usize(1))).unwrap();
89
+ prev := self._entries.get(pos - usize(1)).unwrap();
93
90
  &(self._entries(pos)).* = prev;
94
- &(self._entries((pos - usize(1)))).* = curr;
95
- };
91
+ &(self._entries(pos - usize(1))).* = curr;
92
+ });
96
93
  }
97
94
  );
98
95
  }),
99
-
100
96
  // Remove the entry with key `k`. Returns the old value, or .None.
101
- remove : (fn(self: Self, k: K, where(K <: Ord(K))) -> ?V)({
97
+ remove : (fn(self : Self, k : K, where(K <: Ord(K))) -> ?(V))({
102
98
  r := self._find(k);
103
99
  cond(
104
100
  r.found => {
@@ -106,155 +102,170 @@ impl(forall(K : Type, V : Type), BTreeMap(K, V),
106
102
  self._entries.remove(r.idx);
107
103
  .Some(v)
108
104
  },
109
- true => .None
105
+ true =>.None
110
106
  )
111
107
  }),
112
-
113
108
  // Return the entry with the smallest key, or .None.
114
- min : (fn(self: Self) -> ?BTreeEntry(K, V))(
109
+ min : (fn(self : Self) -> ?(BTreeEntry(K, V)))(
115
110
  cond(
116
- (self._entries.len() == usize(0)) => .None,
117
- true => .Some(self._entries.get(usize(0)).unwrap())
111
+ (self._entries.len() == usize(0)) =>.None,
112
+ true =>.Some(self._entries.get(usize(0)).unwrap())
118
113
  )
119
114
  ),
120
-
121
115
  // Return the entry with the largest key, or .None.
122
- max : (fn(self: Self) -> ?BTreeEntry(K, V))(
116
+ max : (fn(self : Self) -> ?(BTreeEntry(K, V)))(
123
117
  cond(
124
- (self._entries.len() == usize(0)) => .None,
125
- true => .Some(self._entries.get((self._entries.len() - usize(1))).unwrap())
118
+ (self._entries.len() == usize(0)) =>.None,
119
+ true =>.Some(self._entries.get(self._entries.len() - usize(1)).unwrap())
126
120
  )
127
121
  )
128
122
  );
129
-
130
123
  /**
131
- * Value iterator for BTreeMap - yields BTreeEntry(K, V) in sorted key order
132
- */
124
+ * Value iterator for BTreeMap - yields BTreeEntry(K, V) in sorted key order
125
+ */
133
126
  BTreeMapIter :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
134
127
  struct(
135
128
  _entries : ArrayList(BTreeEntry(K, V)),
136
- _index : usize
129
+ _index : usize
137
130
  )
138
131
  );
139
-
140
- impl(forall(K : Type, V : Type), BTreeMapIter(K, V), Iterator(
141
- Item : BTreeEntry(K, V),
142
- next : (fn(self : *(Self)) -> Option(BTreeEntry(K, V)))(
143
- cond(
144
- (self._index >= self._entries.len()) => .None,
145
- true => {
146
- entry := self._entries.get(self._index).unwrap();
147
- self._index = (self._index + usize(1));
148
- .Some(entry)
149
- }
132
+ impl(
133
+ forall(K : Type, V : Type),
134
+ BTreeMapIter(K, V),
135
+ Iterator(
136
+ Item : BTreeEntry(K, V),
137
+ next : (fn(self : *(Self)) -> Option(BTreeEntry(K, V)))(
138
+ cond(
139
+ (self._index >= self._entries.len()) =>.None,
140
+ true => {
141
+ entry := self._entries.get(self._index).unwrap();
142
+ self._index = (self._index + usize(1));
143
+ .Some(entry)
144
+ }
145
+ )
150
146
  )
151
147
  )
152
- ));
153
-
154
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
148
+ );
149
+ impl(
150
+ forall(K : Type, V : Type),
151
+ BTreeMap(K, V),
155
152
  into_iter : (fn(self : Self) -> BTreeMapIter(K, V))(
156
- BTreeMapIter(K, V)(_entries: self._entries, _index: usize(0))
153
+ BTreeMapIter(K, V)(_entries : self._entries, _index : usize(0))
157
154
  )
158
155
  );
159
-
160
156
  /**
161
- * Pointer iterator for BTreeMap - yields pointers to BTreeEntry(K, V) in sorted key order
162
- */
157
+ * Pointer iterator for BTreeMap - yields pointers to BTreeEntry(K, V) in sorted key order
158
+ */
163
159
  BTreeMapIterPtr :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
164
160
  struct(
165
161
  _entries : ArrayList(BTreeEntry(K, V)),
166
- _index : usize
162
+ _index : usize
167
163
  )
168
164
  );
169
-
170
- impl(forall(K : Type, V : Type), BTreeMapIterPtr(K, V), Iterator(
171
- Item : *(BTreeEntry(K, V)),
172
- next : (fn(self : *(Self)) -> Option(*(BTreeEntry(K, V))))(
173
- cond(
174
- (self._index >= self._entries.len()) => .None,
175
- true =>
176
- match(self._entries._ptr,
177
- .Some(ptr) => {
178
- element_ptr := (ptr &+ self._index);
179
- self._index = (self._index + usize(1));
180
- .Some(element_ptr)
181
- },
182
- .None => .None
183
- )
165
+ impl(
166
+ forall(K : Type, V : Type),
167
+ BTreeMapIterPtr(K, V),
168
+ Iterator(
169
+ Item : *(BTreeEntry(K, V)),
170
+ next : (fn(self : *(Self)) -> Option(*(BTreeEntry(K, V))))(
171
+ cond(
172
+ (self._index >= self._entries.len()) =>.None,
173
+ true =>
174
+ match(
175
+ self._entries._ptr,
176
+ .Some(ptr) => {
177
+ element_ptr := (ptr &+ self._index);
178
+ self._index = (self._index + usize(1));
179
+ .Some(element_ptr)
180
+ },
181
+ .None =>.None
182
+ )
183
+ )
184
184
  )
185
185
  )
186
- ));
187
-
188
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
186
+ );
187
+ impl(
188
+ forall(K : Type, V : Type),
189
+ BTreeMap(K, V),
189
190
  iter : (fn(self : *(Self)) -> BTreeMapIterPtr(K, V))(
190
- BTreeMapIterPtr(K, V)(_entries: self.*._entries, _index: usize(0))
191
+ BTreeMapIterPtr(K, V)(_entries : self.*._entries, _index : usize(0))
191
192
  )
192
193
  );
193
-
194
194
  /**
195
- * Keys iterator - wraps BTreeMapIter and yields only keys in sorted order
196
- */
195
+ * Keys iterator - wraps BTreeMapIter and yields only keys in sorted order
196
+ */
197
197
  BTreeMapKeys :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
198
198
  struct(
199
199
  _inner : BTreeMapIter(K, V)
200
200
  )
201
201
  );
202
-
203
- impl(forall(K : Type, V : Type), BTreeMapKeys(K, V), Iterator(
204
- Item : K,
205
- next : (fn(self : *(Self)) -> Option(K))(
206
- match(self._inner.next(),
207
- .None => .None,
208
- .Some(entry) => .Some(entry.key)
202
+ impl(
203
+ forall(K : Type, V : Type),
204
+ BTreeMapKeys(K, V),
205
+ Iterator(
206
+ Item : K,
207
+ next : (fn(self : *(Self)) -> Option(K))(
208
+ match(
209
+ self._inner.next(),
210
+ .None =>.None,
211
+ .Some(entry) =>.Some(entry.key)
212
+ )
209
213
  )
210
214
  )
211
- ));
212
-
213
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
215
+ );
216
+ impl(
217
+ forall(K : Type, V : Type),
218
+ BTreeMap(K, V),
214
219
  keys : (fn(self : Self) -> BTreeMapKeys(K, V))(
215
- BTreeMapKeys(K, V)(_inner: BTreeMapIter(K, V)(_entries: self._entries, _index: usize(0)))
220
+ BTreeMapKeys(K, V)(_inner : BTreeMapIter(K, V)(_entries : self._entries, _index : usize(0)))
216
221
  )
217
222
  );
218
-
219
223
  /**
220
- * Values iterator - wraps BTreeMapIter and yields only values in sorted key order
221
- */
224
+ * Values iterator - wraps BTreeMapIter and yields only values in sorted key order
225
+ */
222
226
  BTreeMapValues :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
223
227
  struct(
224
228
  _inner : BTreeMapIter(K, V)
225
229
  )
226
230
  );
227
-
228
- impl(forall(K : Type, V : Type), BTreeMapValues(K, V), Iterator(
229
- Item : V,
230
- next : (fn(self : *(Self)) -> Option(V))(
231
- match(self._inner.next(),
232
- .None => .None,
233
- .Some(entry) => .Some(entry.value)
231
+ impl(
232
+ forall(K : Type, V : Type),
233
+ BTreeMapValues(K, V),
234
+ Iterator(
235
+ Item : V,
236
+ next : (fn(self : *(Self)) -> Option(V))(
237
+ match(
238
+ self._inner.next(),
239
+ .None =>.None,
240
+ .Some(entry) =>.Some(entry.value)
241
+ )
234
242
  )
235
243
  )
236
- ));
237
-
238
- impl(forall(K : Type, V : Type), BTreeMap(K, V),
244
+ );
245
+ impl(
246
+ forall(K : Type, V : Type),
247
+ BTreeMap(K, V),
239
248
  values : (fn(self : Self) -> BTreeMapValues(K, V))(
240
- BTreeMapValues(K, V)(_inner: BTreeMapIter(K, V)(_entries: self._entries, _index: usize(0)))
249
+ BTreeMapValues(K, V)(_inner : BTreeMapIter(K, V)(_entries : self._entries, _index : usize(0)))
241
250
  )
242
251
  );
243
-
244
- impl(forall(K : Type, V : Type), BTreeMap(K, V), Index(K)(
245
- Output : V,
246
- index : (fn(self: *(Self), idx: K, where(K <: Ord(K))) -> *(Self.Output))({
247
- r := self.*._find(idx);
248
- assert(r.found, "BTreeMap: key not found");
249
- entry_ptr := &(self.*._entries(r.idx));
250
- &(entry_ptr.*.value)
251
- })
252
- ));
253
-
254
- export
252
+ impl(
253
+ forall(K : Type, V : Type),
254
+ BTreeMap(K, V),
255
+ Index(K)(
256
+ Output : V,
257
+ index : (fn(self : *(Self), idx : K, where(K <: Ord(K))) -> *(Self.Output))({
258
+ r := self.*._find(idx);
259
+ assert(r.found, "BTreeMap: key not found");
260
+ entry_ptr := &(self.*._entries(r.idx));
261
+ &(entry_ptr.*.value)
262
+ })
263
+ )
264
+ );
265
+ export(
255
266
  BTreeMap,
256
267
  BTreeMapIter,
257
268
  BTreeMapIterPtr,
258
269
  BTreeMapKeys,
259
270
  BTreeMapValues
260
- ;
271
+ );