Handle trait use conflict resolution
[hiphop-php.git] / hphp / hack / hhi / rx / interfaces.hhi
blobf8fe0729cbb0e8222ab94c24f738d825692d82dd
1 <?hh // partial
2 /**
3  * Copyright (c) 2014, Facebook, Inc.
4  * All rights reserved.
5  *
6  * This source code is licensed under the MIT license found in the
7  * LICENSE file in the "hack" directory of this source tree.
8  *
9  */
11 /**
12  * This file provides type information for some of hack's reactive interfaces
13  *
14  * YOU SHOULD NEVER INCLUDE THIS FILE ANYWHERE!!!
15  */
17 namespace HH\Rx;
19 /* See documentation for \HH\Traversable */
20 <<__Sealed(
21   namespace\KeyedTraversable::class,
22   namespace\Iterator::class,
23   namespace\IteratorAggregate::class,
24   \HH\Container::class
25 )>>
26 interface Traversable<+Tv> extends \HH\Traversable<Tv> {}
28 /* See documentation for \HH\KeyedTraversable */
29 <<__Sealed(
30   namespace\KeyedIterable::class,
31   namespace\KeyedIterator::class,
32   \HH\KeyedContainer::class
33 )>>
34 interface KeyedTraversable<+Tk, +Tv>
35   extends namespace\Traversable<Tv>, \HH\KeyedTraversable<Tk, Tv> {}
37 /* See documentation for \HH\Iterator */
38 interface Iterator<+Tv> extends namespace\Traversable<Tv>, \HH\Iterator<Tv> {
39   /**
40    * Return the current value at the current iterator position.
41    *
42    * @return - The current value of type `Tv`.
43    */
44   <<__Pure, __MaybeMutable>>
45   public function current(): Tv;
46   /**
47    * Move the iterator position to the next element.
48    *
49    */
50   <<__Pure, __Mutable>>
51   public function next(): void;
52   /**
53    * Rewind the iterator position to its beginning.
54    *
55    * This rewinds back to the first element of the `Iterator`.
56    */
57   <<__Pure, __Mutable>>
58   public function rewind(): void;
59   /**
60    * Checks to see if the current iterator position is valid.
61    *
62    * This method is called after `rewind()` and `next()` to check if the
63    * current iterator position is valid.
64    *
65    * @return - `true` if the position is valid; `false` otherwise.
66    */
67   <<__Pure, __MaybeMutable>>
68   public function valid(): bool;
71 interface KeyedIterator<+Tk, +Tv>
72   extends
73     namespace\KeyedTraversable<Tk, Tv>,
74     namespace\Iterator<Tv>,
75     \HH\KeyedIterator<Tk, Tv> {
76   /**
77    * Return the current key at the current iterator position.
78    *
79    * @return - The current key of type `Tk`.
80    */
81   <<__Pure, __MaybeMutable>>
82   public function key(): Tk;
85 /* See documentation for \AsyncIterator */
86 interface AsyncIterator<+Tv> extends \HH\AsyncIterator<Tv> {
87   /**
88    * Move the async iterator to the next `Awaitable` position.
89    *
90    * ```
91    * foreach ($async_iter await $async_iter->next() $value)
92    * ```
93    *
94    * The above is the longhand syntax for `await as $value`.
95    *
96    * @return - The next `Awaitable` in the iterator sequence.
97    */
98   <<__Pure, __Mutable>>
99   public function next(): Awaitable<?(mixed, Tv)>;
102 /* See documentation for \AsyncKeyedIterator */
103 interface AsyncKeyedIterator<+Tk, +Tv>
104   extends namespace\AsyncIterator<Tv>, \HH\AsyncKeyedIterator<Tk, Tv> {
105   /**
106    * Move the async iterator to the next `Awaitable` position.
107    *
108    * ```
109    * foreach ($async_iter await $async_iter->next() $key=>$value)
110    * ```
111    *
112    * The above is the longhand syntax for `await as $key=>$value`.
113    *
114    * @return - The next `Awaitable` in the iterator sequence.
115    */
116   <<__Pure, __Mutable>>
117   public function next(): Awaitable<?(Tk, Tv)>;
120 /* See documentation for \IteratorAggregate */
121 interface IteratorAggregate<+Tv>
122   extends namespace\Traversable<Tv>, \IteratorAggregate<Tv> {
123   /**
124    * Returns an iterator to be used to iterate over the object's elements.
125    *
126    * @return - An `Iterator` for iteration.
127    */
128   <<__Pure, __MutableReturn, __MaybeMutable>>
129   public function getIterator(): namespace\Iterator<Tv>;
132 interface Iterable<+Tv>
133   extends namespace\IteratorAggregate<Tv>, \HH\Iterable<Tv> {
134   /**
135    * Returns an iterator that points to beginning of the current `Iterable`.
136    *
137    * @return - An `Iterator` that allows you to traverse the current `Iterable`.
138    */
139   <<__Pure, __MutableReturn, __MaybeMutable>>
140   public function getIterator(): namespace\Iterator<Tv>;
141   /**
142    * Returns an `array` with the values from the current `Iterable`.
143    *
144    * The keys in the current `Iterable` are discarded and replaced with integer
145    * indices, starting with 0.
146    *
147    * @return - an `array` containing the values from the current `Iterable`.
148    */
149   <<__Pure, __MaybeMutable>>
150   public function toValuesArray(): varray<Tv>;
151   /**
152    * Returns an immutable vector (`ImmVector`) converted from the current
153    * `Iterable`.
154    *
155    * Any keys in the current `Iterable` are discarded and replaced with integer
156    * indices, starting with 0.
157    *
158    * @return - an `ImmVector` converted from the current `Iterable`.
159    */
160   <<__Pure, __MaybeMutable>>
161   public function toImmVector(): ImmVector<Tv>;
162   /**
163    * Returns an immutable set (`ImmSet`) converted from the current `Iterable`.
164    *
165    * Any keys in the current `Iterable` are discarded.
166    *
167    * @return - an `ImmSet` converted from the current `Iterable`.
168    */
169   <<__Pure, __MaybeMutable>>
170   public function toImmSet(): ImmSet<Tv> where Tv as arraykey;
171   /**
172    * Returns a lazy, access elements only when needed view of the current
173    * `Iterable`.
174    *
175    * Normally, memory is allocated for all of the elements of the `Iterable`.
176    * With a lazy view, memory is allocated for an element only when needed or
177    * used in a calculation like in `map()` or `filter()`.
178    *
179    * @return - an `Iterable` representing the lazy view into the current
180    *           `Iterable`.
181    *
182    * @guide /hack/collections/examples
183    */
184   <<__Pure, __MutableReturn, __MaybeMutable>>
185   public function lazy(): namespace\Iterable<Tv>;
186   /**
187    * Returns an `Iterable` containing the current `Iterable`'s values.
188    *
189    * Any keys are discarded.
190    *
191    * @return An `Iterable` with the values of the current `Iterable`.
192    */
193   <<__Pure, __MutableReturn, __MaybeMutable>>
194   public function values(): namespace\Iterable<Tv>;
195   /**
196    * Returns an `Iterable` containing the values after an operation has been
197    * applied to each value in the current `Iterable`.
198    *
199    * Every value in the current `Iterable` is affected by a call to `map()`,
200    * unlike `filter()` where only values that meet a certain criteria are
201    * affected.
202    *
203    * @param $fn - The callback containing the operation to apply to the
204    *              `Iterable` values.
205    *
206    * @return - an `Iterable` containing the values after a user-specified
207    *           operation is applied.
208    *
209    * @guide /hack/collections/examples
210    */
211   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
212   public function map<Tu>(
213     <<__AtMostRxAsFunc>>(function(Tv): Tu) $fn,
214   ): namespace\Iterable<Tu>;
215   /**
216    * Returns an `Iterable` containing the values of the current `Iterable` that
217    * meet a supplied condition.
218    *
219    * Only values that meet a certain criteria are affected by a call to
220    * `filter()`, while all values are affected by a call to `map()`.
221    *
222    * @param $fn - The callback containing the condition to apply to the
223    *              `Itearble` values.
224    *
225    * @return - an `Iterable` containing the values after a user-specified
226    *           condition is applied.
227    *
228    * @guide /hack/collections/examples
229    */
230   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
231   public function filter(
232     <<__AtMostRxAsFunc>>(function(Tv): bool) $fn,
233   ): namespace\Iterable<Tv>;
234   /**s
235    *  Returns an `Iterable` where each element is a `Pair` that combines the
236    *  element of the current `Iterable` and the provided `Traversable`.
237    *
238    *  If the number of elements of the `Iterable` are not equal to the number of
239    *  elements in the `Traversable`, then only the combined elements up to and
240    *  including the final element of the one with the least number of elements
241    *  is included.
242    *
243    *  @param $traversable - The `Traversable` to use to combine with the
244    *                        elements of the current `Iterable`.
245    *
246    *  @return - The `Iterable` that combines the values of the current
247    *            `Itearable` with the provided `Traversable`.
248    */
249   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
250   public function zip<Tu>(
251     <<__OnlyRxIfImpl(namespace\Traversable::class)>> \HH\Traversable<Tu> $traversable,
252   ): namespace\Iterable<Pair<Tv, Tu>>;
253   /**
254    * Returns an `Iterable` containing the first `n` values of the current
255    * `Iterable`.
256    *
257    * The returned `Iterable` will always be a proper subset of the current
258    * `Iterable`.
259    *
260    * `$n` is 1-based. So the first element is 1, the second 2, etc.
261    *
262    * @param $n - The last element that will be included in the returned
263    *             `Iterable`.
264    *
265    * @return - An `Iterable that is a proper subset of the current `Iterable`
266    *           up to `n` elements.
267    */
268   <<__Pure, __MutableReturn, __MaybeMutable>>
269   public function take(int $n): namespace\Iterable<Tv>;
270   /**
271    * Returns an `Iterable` containing the values of the current `Iterable` up
272    * to but not including the first value that produces `false` when passed to
273    * the specified callback.
274    *
275    * The returned `Iterable` will always be a proper subset of the current
276    * `Iterable`.
277    *
278    * @param $fn - The callback that is used to determine the stopping
279    *              condition.
280    *
281    * @return - An `Iterable` that is a proper subset of the current `Iterable`
282    *           up until the callback returns `false`.
283    */
284   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
285   public function takeWhile(
286     <<__AtMostRxAsFunc>>(function(Tv): bool) $fn,
287   ): namespace\Iterable<Tv>;
288   /**
289    * Returns an `Iterable` containing the values after the `n`-th element of the
290    * current `Iterable`.
291    *
292    * The returned `Iterable` will always be a proper subset of the current
293    * `Iterable`.
294    *
295    * `$n` is 1-based. So the first element is 1, the second 2, etc.
296    *
297    * @param $n - The last element to be skipped; the `$n+1` element will be
298    *             the first one in the returned `Iterable`.
299    *
300    * @return - An `Iterable` that is a proper subset of the current `Iterable`
301    *           containing values after the specified `n`-th element.
302    */
303   <<__Pure, __MutableReturn, __MaybeMutable>>
304   public function skip(int $n): namespace\Iterable<Tv>;
305   /**
306    * Returns an `Iterable` containing the values of the current `Iterable`
307    * starting after and including the first value that produces `true` when
308    * passed to the specified callback.
309    *
310    * The returned `Iterable` will always be a proper subset of the current
311    * `Iterable`.
312    *
313    * @param $fn - The callback used to determine the starting element for the
314    *              returned `Iterable`.
315    *
316    * @return - An `Iterable` that is a proper subset of the current `Iterable`
317    *           starting after the callback returns `true`.
318    */
319   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
320   public function skipWhile(
321     <<__AtMostRxAsFunc>>(function(Tv): bool) $fn,
322   ): namespace\Iterable<Tv>;
323   /**
324    * Returns a subset of the current `Iterable` starting from a given key up
325    * to, but not including, the element at the provided length from the
326    * starting key.
327    *
328    * `$start` is 0-based. `$len` is 1-based. So `slice(0, 2)` would return the
329    * elements at key 0 and 1.
330    *
331    * The returned `Iterable` will always be a proper subset of the current
332    * `Iterable`.
333    *
334    * @param $start - The starting key of the current `Iterable` to begin the
335    *                 returned `Iterable`.
336    * @param $len - The length of the returned `Iterable`.
337    *
338    * @return - An `Iterable` that is a proper subset of the current `Iterable`
339    *           starting at `$start` up to but not including the element
340    *           `$start + $len`.
341    */
342   <<__Pure, __MutableReturn, __MaybeMutable>>
343   public function slice(int $start, int $len): namespace\Iterable<Tv>;
344   /**
345    * Returns an `Iterable` that is the concatenation of the values of the
346    * current `Iterable` and the values of the provided `Traversable`.
347    *
348    * The values of the provided `Traversable` is concatenated to the end of the
349    * current `Iterable` to produce the returned `Iterable`.
350    *
351    * @param $traversable - The `Traversable` to concatenate to the current
352    *                       `Iterable`.
353    *
354    * @return - The concatenated `Iterable`.
355    *
356    * @guide /hack/generics/constraints
357    */
358   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
359   public function concat<Tu super Tv>(
360     <<__OnlyRxIfImpl(namespace\Traversable::class)>> \HH\Traversable<Tu> $traversable,
361   ): namespace\Iterable<Tu>;
362   /**
363    * Returns the first value in the current `Iterable`.
364    *
365    * @return - The first value in the current `Iterable`, or `null` if the
366    *           current `Iterable` is empty.
367    */
368   <<__Pure, __MaybeMutable>>
369   public function firstValue(): ?Tv;
370   /**
371    * Returns the last value in the current `Iterable`.
372    *
373    * @return - The last value in the current `Iterable`, or `null` if the
374    *           current `Iterable` is empty.
375    */
376   <<__Pure, __MaybeMutable>>
377   public function lastValue(): ?Tv;
380 interface KeyedIterable<Tk, +Tv>
381   extends
382     namespace\KeyedTraversable<Tk, Tv>,
383     namespace\Iterable<Tv>,
384     \HH\KeyedIterable<Tk, Tv> {
385   /**
386    * Returns an iterator that points to beginning of the current
387    * `KeyedIterable`.
388    *
389    * @return - A `KeyedIterator` that allows you to traverse the current
390    *           `KeyedIterable`.
391    */
392   <<__Pure, __MutableReturn, __MaybeMutable>>
393   public function getIterator(): namespace\KeyedIterator<Tk, Tv>;
394   /**
395    * Returns an `array` with the keys from the current `KeyedIterable`.
396    *
397    * @return - an `array` containing the values from the current
398    *           `KeyedIterable`.
399    */
400   <<__Pure, __MaybeMutable>>
401   public function toKeysArray(): varray;
402  /**
403    * Returns an immutable map (`ImmMap`) based on the keys and values of the
404    * current `KeyedIterable`.
405    *
406    * @return - an `ImmMap` that has the keys and associated values of the
407    *           current `KeyedIterable`.
408    */
409   <<__Pure, __MaybeMutable>>
410   public function toImmMap(): ImmMap<Tk, Tv> where Tk as arraykey;
411   /**
412    * Returns a lazy, access elements only when needed view of the current
413    * `KeyedIterable`.
414    *
415    * Normally, memory is allocated for all of the elements of the
416    * `KeyedIterable`. With a lazy view, memory is allocated for an element only
417    * when needed or used in a calculation like in `map()` or `filter()`.
418    *
419    * @return - a `KeyedIterable` representing the lazy view into the current
420    *           `KeyedIterable`.
421    *
422    * @guide /hack/collections/examples
423    */
424   <<__Pure, __MutableReturn, __MaybeMutable>>
425   public function lazy(): namespace\KeyedIterable<Tk, Tv>;
426   /**
427    * Returns an `Iterable` containing the current `KeyedIterable`'s values.
428    *
429    * Any keys are discarded.
430    *
431    * @return An `Iterable` with the values of the current `KeyedIterable`.
432    */
433   <<__Pure, __MutableReturn, __MaybeMutable>>
434   public function values(): namespace\Iterable<Tv>;
435   /**
436    * Returns an `Iterable` containing the current `KeyedIterable`'s keys.
437    *
438    * Any values are discarded.
439    *
440    * @return An `Iterable` with the keys of the current `KeyedIterable`.
441    */
442   <<__Pure, __MutableReturn, __MaybeMutable>>
443   public function keys(): namespace\Iterable<Tk>;
444   /**
445    * Returns a `KeyedIterable` containing the values after an operation has been
446    * applied to each value in the current `KeyedIterable`.
447    *
448    * Every value in the current `KeyedIterable` is affected by a call to
449    * `map()`, unlike `filter()` where only values that meet a certain criteria
450    * are affected.
451    *
452    * @param $fn - The callback containing the operation to apply to the
453    *              `KeyedIterable` values.
454    *
455    * @return - a `KeyedIterable` containing the values after a user-specified
456    *           operation is applied.
457    *
458    * @guide /hack/collections/examples
459    */
460   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
461   public function map<Tu>(
462     <<__AtMostRxAsFunc>>(function(Tv): Tu) $fn,
463   ): namespace\KeyedIterable<Tk, Tu>;
464   /**
465    * Returns a `KeyedIterable` containing the values after an operation has
466    * been applied to each key and value in the current `KeyedIterable`.
467    *
468    * Every key and value in the current `KeyedIterable` is affected by a call to
469    * `mapWithKey()`, unlike `filterWithKey()` where only values that meet a
470    * certain criteria are affected.
471    *
472    * @param $fn - The callback containing the operation to apply to the
473    *              `KeyedIterable` keys and values.
474    *
475    * @return - a `KeyedIterable` containing the values after a user-specified
476    *           operation on the current `KeyedIterable`'s keys and values is
477    *           applied.
478    */
479   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
480   public function mapWithKey<Tu>(
481     <<__AtMostRxAsFunc>>(function(Tk, Tv): Tu) $fn,
482   ): namespace\KeyedIterable<Tk, Tu>;
483   /**
484    * Returns a `KeyedIterable` containing the values of the current
485    * `KeyedIterable` that meet a supplied condition.
486    *
487    * Only values that meet a certain criteria are affected by a call to
488    * `filter()`, while all values are affected by a call to `map()`.
489    *
490    * @param $fn - The callback containing the condition to apply to the
491    *              `KeyedItearble` values.
492    *
493    * @return - a `KeyedIterable` containing the values after a user-specified
494    *           condition is applied.
495    *
496    * @guide /hack/collections/examples
497    */
498   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
499   public function filter(
500     <<__AtMostRxAsFunc>>(function(Tv): bool) $fn,
501   ): namespace\KeyedIterable<Tk, Tv>;
502   /**
503    * Returns a `KeyedIterable` containing the values of the current
504    * `KeyedIterable` that meet a supplied condition applied to its keys and
505    * values.
506    *
507    * Only keys and values that meet a certain criteria are affected by a call to
508    * `filterWithKey()`, while all values are affected by a call to
509    * `mapWithKey()`.
510    *
511    * @param $fn - The callback containing the condition to apply to the
512    *              `KeyedIterable` keys and values.
513    *
514    * @return - a `KeyedIterable` containing the values after a user-specified
515    *           condition is applied to the keys and values of the current
516    *           `KeyedIterable`.
517    *
518    */
519   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
520   public function filterWithKey(
521     <<__AtMostRxAsFunc>>(function(Tk, Tv): bool) $fn,
522   ): namespace\KeyedIterable<Tk, Tv>;
523   /**
524    *  Returns a `KeyedIterable` where each element is a `Pair` that combines the
525    *  element of the current `KeyedIterable` and the provided `Traversable`.
526    *
527    *  If the number of elements of the `KeyedIterable` are not equal to the
528    *  number of elements in the `Traversable`, then only the combined elements
529    *  up to and including the final element of the one with the least number of
530    *  elements is included.
531    *
532    *  @param $traversable - The `Traversable` to use to combine with the
533    *                        elements of the current `KeyedIterable`.
534    *
535    *  @return - The `KeyedIterable` that combines the values of the current
536    *            `KeyedItearable` with the provided `Traversable`.
537    */
538   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
539   public function zip<Tu>(
540     <<__OnlyRxIfImpl(namespace\Traversable::class)>> \HH\Traversable<Tu> $traversable,
541   ): namespace\KeyedIterable<Tk, Pair<Tv, Tu>>;
542   /**
543    * Returns a `KeyedIterable` containing the first `n` values of the current
544    * `KeyedIterable`.
545    *
546    * The returned `KeyedIterable` will always be a proper subset of the current
547    * `Iterable`.
548    *
549    * `$n` is 1-based. So the first element is 1, the second 2, etc.
550    *
551    * @param $n - The last element that will be included in the returned
552    *             `KeyedIterable`.
553    *
554    * @return - A `KeyedIterable that is a proper subset of the current
555    *           `KeyedIterable` up to `n` elements.
556    */
557   <<__Pure, __MutableReturn, __MaybeMutable>>
558   public function take(int $n): namespace\KeyedIterable<Tk, Tv>;
559   /**
560    * Returns a `KeyedIterable` containing the values of the current
561    * `KeyedIterable` up to but not including the first value that produces
562    * `false` when passed to the specified callback.
563    *
564    * The returned `KeyedIterable` will always be a proper subset of the current
565    * `KeyedIterable`.
566    *
567    * @param $fn - The callback that is used to determine the stopping
568    *              condition.
569    *
570    * @return - A `KeyedIterable` that is a proper subset of the current
571    *           `KeyedIterable` up until the callback returns `false`.
572    */
573   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
574   public function takeWhile(
575     <<__AtMostRxAsFunc>>(function(Tv): bool) $fn,
576   ): namespace\KeyedIterable<Tk, Tv>;
577   /**
578    * Returns a `KeyedIterable` containing the values after the `n`-th element
579    * of the current `KeyedIterable`.
580    *
581    * The returned `KeyedIterable` will always be a proper subset of the current
582    * `KeyedIterable`.
583    *
584    * `$n` is 1-based. So the first element is 1, the second 2, etc.
585    *
586    * @param $n - The last element to be skipped; the `$n+1` element will be
587    *             the first one in the returned `KeyedIterable`.
588    *
589    * @return - A `KeyedIterable` that is a proper subset of the current
590    *           `KeyedIterable`  containing values after the specified `n`-th
591    *           element.
592    */
593   <<__Pure, __MutableReturn, __MaybeMutable>>
594   public function skip(int $n): namespace\KeyedIterable<Tk, Tv>;
595   /**
596    * Returns a `KeyedIterable` containing the values of the current
597    * `KeyedIterable` starting after and including the first value that produces
598    * `true` when passed to the specified callback.
599    *
600    * The returned `KeyedIterable` will always be a proper subset of the current
601    * `KeyedIterable`.
602    *
603    * @param $fn - The callback used to determine the starting element for the
604    *              returned `KeyedIterable`.
605    *
606    * @return - A `KeyedIterable` that is a proper subset of the current
607    *           `KeyedIterable` starting after the callback returns `true`.
608    */
609   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
610   public function skipWhile(
611     <<__AtMostRxAsFunc>>(function(Tv): bool) $fn,
612   ): namespace\KeyedIterable<Tk, Tv>;
613   /**
614    * Returns a subset of the current `KeyedIterable` starting from a given key
615    * up to, but not including, the element at the provided length from the
616    * starting key.
617    *
618    * `$start` is 0-based. `$len` is 1-based. So `slice(0, 2)` would return the
619    * elements at key 0 and 1.
620    *
621    * The returned `KeyedIterable` will always be a proper subset of the current
622    * `KeyedIterable`.
623    *
624    * @param $start - The starting key of the current `KeyedIterable` to begin
625    *                 the returned `KeyedIterable`.
626    * @param $len - The length of the returned `KeyedIterable`.
627    *
628    * @return - A `KeyedIterable` that is a proper subset of the current
629    *           `KeyedIterable` starting at `$start` up to but not including the
630    *           element `$start + $len`.
631    */
632   <<__Pure, __MutableReturn, __MaybeMutable>>
633   public function slice(int $start, int $len): namespace\KeyedIterable<Tk, Tv>;
634   /**
635    * Returns an `Iterable` that is the concatenation of the values of the
636    * current `KeyedIterable` and the values of the provided `Traversable`.
637    *
638    * The values of the provided `Traversable` is concatenated to the end of the
639    * current `KeyedIterable` to produce the returned `Iterable`.
640    *
641    * @param $traversable - The `Traversable` to concatenate to the current
642    *                       `KeyedIterable`.
643    *
644    * @return - The concatenated `Iterable`.
645    *
646    * @guide /hack/generics/constraints
647    */
648   <<__Pure, __AtMostRxAsArgs, __MutableReturn, __MaybeMutable>>
649   public function concat<Tu super Tv>(
650     <<__OnlyRxIfImpl(namespace\Traversable::class)>> \HH\Traversable<Tu> $traversable,
651   ): namespace\Iterable<Tu>;
652   /**
653    * Returns the first value in the current `KeyedIterable`.
654    *
655    * @return - The first value in the current `KeyedIterable`, or `null` if the
656    *           current `KeyedIterable` is empty.
657    */
658   <<__Pure, __MaybeMutable>>
659   public function firstValue(): ?Tv;
660   /**
661    * Returns the first key in the current `KeyedIterable`.
662    *
663    * @return - The first key in the current `KeyedIterable`, or `null` if the
664    *           current `KeyedIterable` is empty.
665    */
666   <<__Pure, __MaybeMutable>>
667   public function firstKey(): ?Tk;
668   /**
669    * Returns the last value in the current `KeyedIterable`.
670    *
671    * @return - The last value in the current `KeyedIterable`, or `null` if the
672    *           current `KeyedIterable` is empty.
673    */
674   <<__Pure, __MaybeMutable>>
675   public function lastValue(): ?Tv;
676   /**
677    * Returns the last key in the current `KeyedIterable`.
678    *
679    * @return - The last key in the current `KeyedIterable`, or `null` if the
680    *           current `KeyedIterable` is empty.
681    */
682   <<__Pure, __MaybeMutable>>
683   public function lastKey(): ?Tk;
686 interface Countable extends \Countable {
687   <<__Pure, __MaybeMutable>>
688   public function count(): int;