lisette-stdlib 0.1.13

Little language inspired by Rust that compiles to Go
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
// Generated by Lisette bindgen
// Source: reflect (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.12

import "go:iter"

pub enum Kind: uint {
  Array = 17,
  Bool = 1,
  Chan = 18,
  Complex128 = 16,
  Complex64 = 15,
  Float32 = 13,
  Float64 = 14,
  Func = 19,
  Int = 2,
  Int16 = 4,
  Int32 = 5,
  Int64 = 6,
  Int8 = 3,
  Interface = 20,
  Invalid = 0,
  Map = 21,
  Pointer = 22,
  Ptr = 22,
  Slice = 23,
  String = 24,
  Struct = 25,
  Uint = 7,
  Uint16 = 9,
  Uint32 = 10,
  Uint64 = 11,
  Uint8 = 8,
  Uintptr = 12,
  UnsafePointer = 26,
}

pub const Array: Kind = 17

pub const Bool: Kind = 1

pub const Chan: Kind = 18

pub const Complex128: Kind = 16

pub const Complex64: Kind = 15

pub const Float32: Kind = 13

pub const Float64: Kind = 14

pub const Func: Kind = 19

pub const Int: Kind = 2

pub const Int16: Kind = 4

pub const Int32: Kind = 5

pub const Int64: Kind = 6

pub const Int8: Kind = 3

pub const Interface: Kind = 20

pub const Invalid: Kind = 0

pub const Map: Kind = 21

pub const Pointer: Kind = 22

/// Ptr is the old name for the [Pointer] kind.
pub const Ptr: Kind = 22

pub const Slice: Kind = 23

pub const String: Kind = 24

pub const Struct: Kind = 25

pub const Uint: Kind = 7

pub const Uint16: Kind = 9

pub const Uint32: Kind = 10

pub const Uint64: Kind = 11

pub const Uint8: Kind = 8

pub const Uintptr: Kind = 12

pub const UnsafePointer: Kind = 26

pub fn Append(s: Value, x: VarArgs<Value>) -> Value

pub fn AppendSlice(s: Value, t: Value) -> Value

pub fn ArrayOf(length: int, elem: Type) -> Type

pub fn ChanOf(dir: ChanDir, t: Type) -> Type

/// Copy copies the contents of src into dst until either
/// dst has been filled or src has been exhausted.
/// It returns the number of elements copied.
/// Dst and src each must have kind [Slice] or [Array], and
/// dst and src must have the same element type.
/// It dst is an [Array], it panics if [Value.CanSet] returns false.
/// 
/// As a special case, src can have kind [String] if the element type of dst is kind [Uint8].
pub fn Copy(dst: Value, src: Value) -> int

/// DeepEqual reports whether x and y are “deeply equal,” defined as follows.
/// Two values of identical type are deeply equal if one of the following cases applies.
/// Values of distinct types are never deeply equal.
/// 
/// Array values are deeply equal when their corresponding elements are deeply equal.
/// 
/// Struct values are deeply equal if their corresponding fields,
/// both exported and unexported, are deeply equal.
/// 
/// Func values are deeply equal if both are nil; otherwise they are not deeply equal.
/// 
/// Interface values are deeply equal if they hold deeply equal concrete values.
/// 
/// Map values are deeply equal when all of the following are true:
/// they are both nil or both non-nil, they have the same length,
/// and either they are the same map object or their corresponding keys
/// (matched using Go equality) map to deeply equal values.
/// 
/// Pointer values are deeply equal if they are equal using Go's == operator
/// or if they point to deeply equal values.
/// 
/// Slice values are deeply equal when all of the following are true:
/// they are both nil or both non-nil, they have the same length,
/// and either they point to the same initial entry of the same underlying array
/// (that is, &x[0] == &y[0]) or their corresponding elements (up to length) are deeply equal.
/// Note that a non-nil empty slice and a nil slice (for example, []byte{} and []byte(nil))
/// are not deeply equal.
/// 
/// Other values - numbers, bools, strings, and channels - are deeply equal
/// if they are equal using Go's == operator.
/// 
/// In general DeepEqual is a recursive relaxation of Go's == operator.
/// However, this idea is impossible to implement without some inconsistency.
/// Specifically, it is possible for a value to be unequal to itself,
/// either because it is of func type (uncomparable in general)
/// or because it is a floating-point NaN value (not equal to itself in floating-point comparison),
/// or because it is an array, struct, or interface containing
/// such a value.
/// On the other hand, pointer values are always equal to themselves,
/// even if they point at or contain such problematic values,
/// because they compare equal using Go's == operator, and that
/// is a sufficient condition to be deeply equal, regardless of content.
/// DeepEqual has been defined so that the same short-cut applies
/// to slices and maps: if x and y are the same slice or the same map,
/// they are deeply equal regardless of content.
/// 
/// As DeepEqual traverses the data values it may find a cycle. The
/// second and subsequent times that DeepEqual compares two pointer
/// values that have been compared before, it treats the values as
/// equal rather than examining the values to which they point.
/// This ensures that DeepEqual terminates.
pub fn DeepEqual(x: Unknown, y: Unknown) -> bool

pub fn FuncOf(in_: Slice<Type>, out: Slice<Type>, variadic: bool) -> Type

pub fn Indirect(v: Value) -> Value

pub fn MakeChan(typ: Type, buffer: int) -> Value

pub fn MakeFunc(typ: Type, fn_: fn(Slice<Value>) -> Slice<Value>) -> Value

pub fn MakeMap(typ: Type) -> Value

pub fn MakeMapWithSize(typ: Type, n: int) -> Value

pub fn MakeSlice(typ: Type, len: int, cap: int) -> Value

pub fn MapOf(key: Type, elem: Type) -> Type

pub fn New(typ: Type) -> Value

pub fn NewAt(typ: Type, p: Unknown) -> Value

pub fn PointerTo(t: Type) -> Type

pub fn PtrTo(t: Type) -> Type

/// Select executes a select operation described by the list of cases.
/// Like the Go select statement, it blocks until at least one of the cases
/// can proceed, makes a uniform pseudo-random choice,
/// and then executes that case. It returns the index of the chosen case
/// and, if that case was a receive operation, the value received and a
/// boolean indicating whether the value corresponds to a send on the channel
/// (as opposed to a zero value received because the channel is closed).
/// Select supports a maximum of 65536 cases.
pub fn Select(cases: Slice<SelectCase>) -> (int, Value, bool)

pub fn SliceAt(typ: Type, p: Unknown, n: int) -> Value

pub fn SliceOf(t: Type) -> Type

pub fn StructOf(fields: Slice<StructField>) -> Type

/// Swapper returns a function that swaps the elements in the provided
/// slice.
/// 
/// Swapper panics if the provided interface is not a slice.
pub fn Swapper(slice: Unknown) -> Option<fn(int, int) -> ()>

/// TypeAssert is semantically equivalent to:
/// 
/// 	v2, ok := v.Interface().(T)
pub fn TypeAssert<T>(v: Value) -> Option<T>

pub fn TypeFor<T>() -> Type

pub fn TypeOf(i: Unknown) -> Option<Type>

pub fn ValueOf(i: Unknown) -> Value

pub fn VisibleFields(t: Type) -> Slice<StructField>

pub fn Zero(typ: Type) -> Value

/// ChanDir represents a channel type's direction.
pub struct ChanDir(int)

/// A MapIter is an iterator for ranging over a map.
/// See [Value.MapRange].
pub type MapIter

/// Method represents a single method.
pub struct Method {
  pub Name: string,
  pub PkgPath: string,
  pub Type: Option<Type>,
  pub Func: Value,
  pub Index: int,
}

/// A SelectCase describes a single case in a select operation.
/// The kind of case depends on Dir, the communication direction.
/// 
/// If Dir is SelectDefault, the case represents a default case.
/// Chan and Send must be zero Values.
/// 
/// If Dir is SelectSend, the case represents a send operation.
/// Normally Chan's underlying value must be a channel, and Send's underlying value must be
/// assignable to the channel's element type. As a special case, if Chan is a zero Value,
/// then the case is ignored, and the field Send will also be ignored and may be either zero
/// or non-zero.
/// 
/// If Dir is [SelectRecv], the case represents a receive operation.
/// Normally Chan's underlying value must be a channel and Send must be a zero Value.
/// If Chan is a zero Value, then the case is ignored, but Send must still be a zero Value.
/// When a receive operation is selected, the received Value is returned by Select.
pub struct SelectCase {
  pub Dir: SelectDir,
  pub Chan: Value,
  pub Send: Value,
}

/// A SelectDir describes the communication direction of a select case.
pub struct SelectDir(int)

/// SliceHeader is the runtime representation of a slice.
/// It cannot be used safely or portably and its representation may
/// change in a later release.
/// Moreover, the Data field is not sufficient to guarantee the data
/// it references will not be garbage collected, so programs must keep
/// a separate, correctly typed pointer to the underlying data.
/// 
/// Deprecated: Use unsafe.Slice or unsafe.SliceData instead.
pub struct SliceHeader {
  pub Data: uint,
  pub Len: int,
  pub Cap: int,
}

/// StringHeader is the runtime representation of a string.
/// It cannot be used safely or portably and its representation may
/// change in a later release.
/// Moreover, the Data field is not sufficient to guarantee the data
/// it references will not be garbage collected, so programs must keep
/// a separate, correctly typed pointer to the underlying data.
/// 
/// Deprecated: Use unsafe.String or unsafe.StringData instead.
pub struct StringHeader {
  pub Data: uint,
  pub Len: int,
}

/// A StructField describes a single field in a struct.
pub struct StructField {
  pub Name: string,
  pub PkgPath: string,
  pub Type: Option<Type>,
  pub Tag: StructTag,
  pub Offset: uint,
  pub Index: Slice<int>,
  pub Anonymous: bool,
}

/// A StructTag is the tag string in a struct field.
/// 
/// By convention, tag strings are a concatenation of
/// optionally space-separated key:"value" pairs.
/// Each key is a non-empty string consisting of non-control
/// characters other than space (U+0020 ' '), quote (U+0022 '"'),
/// and colon (U+003A ':').  Each value is quoted using U+0022 '"'
/// characters and Go string literal syntax.
pub struct StructTag(string)

/// Type is the representation of a Go type.
/// 
/// Not all methods apply to all kinds of types. Restrictions,
/// if any, are noted in the documentation for each method.
/// Use the Kind method to find out the kind of type before
/// calling kind-specific methods. Calling a method
/// inappropriate to the kind of type causes a run-time panic.
/// 
/// Type values are comparable, such as with the == operator,
/// so they can be used as map keys.
/// Two Type values are equal if they represent identical types.
pub interface Type {
  fn Align() -> int
  fn AssignableTo(u: Type) -> bool
  fn Bits() -> int
  fn CanSeq() -> bool
  fn CanSeq2() -> bool
  fn ChanDir() -> ChanDir
  fn Comparable() -> bool
  fn ConvertibleTo(u: Type) -> bool
  fn Elem() -> Type
  fn Field(i: int) -> StructField
  fn FieldAlign() -> int
  fn FieldByIndex(index: Slice<int>) -> StructField
  fn FieldByName(name: string) -> Option<StructField>
  fn FieldByNameFunc(match_: fn(string) -> bool) -> Option<StructField>
  fn Implements(u: Type) -> bool
  fn In(i: int) -> Type
  fn IsVariadic() -> bool
  fn Key() -> Type
  fn Kind() -> Kind
  fn Len() -> int
  fn Method(arg0: int) -> Method
  fn MethodByName(arg0: string) -> Option<Method>
  fn Name() -> string
  fn NumField() -> int
  fn NumIn() -> int
  fn NumMethod() -> int
  fn NumOut() -> int
  fn Out(i: int) -> Type
  fn OverflowComplex(x: complex128) -> bool
  fn OverflowFloat(x: float64) -> bool
  fn OverflowInt(x: int64) -> bool
  fn OverflowUint(x: uint64) -> bool
  fn PkgPath() -> string
  fn Size() -> uint
  fn String() -> string
}

/// Value is the reflection interface to a Go value.
/// 
/// Not all methods apply to all kinds of values. Restrictions,
/// if any, are noted in the documentation for each method.
/// Use the Kind method to find out the kind of value before
/// calling kind-specific methods. Calling a method
/// inappropriate to the kind of type causes a run time panic.
/// 
/// The zero Value represents no value.
/// Its [Value.IsValid] method returns false, its Kind method returns [Invalid],
/// its String method returns "<invalid Value>", and all other methods panic.
/// Most functions and methods never return an invalid value.
/// If one does, its documentation states the conditions explicitly.
/// 
/// A Value can be used concurrently by multiple goroutines provided that
/// the underlying Go value can be used concurrently for the equivalent
/// direct operations.
/// 
/// To compare two Values, compare the results of the Interface method.
/// Using == on two Values does not compare the underlying values
/// they represent.
pub type Value

/// A ValueError occurs when a Value method is invoked on
/// a [Value] that does not support it. Such cases are documented
/// in the description of each method.
pub struct ValueError {
  pub Method: string,
  pub Kind: Kind,
}

const BothDir: ChanDir = 3

const RecvDir: ChanDir = 1

const SelectDefault: SelectDir = 3

const SelectRecv: SelectDir = 2

const SelectSend: SelectDir = 1

const SendDir: ChanDir = 2

impl ChanDir {
  fn String(self) -> string
}

impl Kind {
  /// String returns the name of k.
  fn String(self) -> string
}

impl MapIter {
  /// Key returns the key of iter's current map entry.
  fn Key(self: Ref<MapIter>) -> Value

  /// Next advances the map iterator and reports whether there is another
  /// entry. It returns false when iter is exhausted; subsequent
  /// calls to [MapIter.Key], [MapIter.Value], or [MapIter.Next] will panic.
  fn Next(self: Ref<MapIter>) -> bool

  /// Reset modifies iter to iterate over v.
  /// It panics if v's Kind is not [Map] and v is not the zero Value.
  /// Reset(Value{}) causes iter to not to refer to any map,
  /// which may allow the previously iterated-over map to be garbage collected.
  fn Reset(self: Ref<MapIter>, v: Value)

  /// Value returns the value of iter's current map entry.
  fn Value(self: Ref<MapIter>) -> Value
}

impl Method {
  /// IsExported reports whether the method is exported.
  fn IsExported(self) -> bool
}

impl StructField {
  /// IsExported reports whether the field is exported.
  fn IsExported(self) -> bool
}

impl StructTag {
  /// Get returns the value associated with key in the tag string.
  /// If there is no such key in the tag, Get returns the empty string.
  /// If the tag does not have the conventional format, the value
  /// returned by Get is unspecified. To determine whether a tag is
  /// explicitly set to the empty string, use [StructTag.Lookup].
  fn Get(self, key: string) -> string

  /// Lookup returns the value associated with key in the tag string.
  /// If the key is present in the tag the value (which may be empty)
  /// is returned. Otherwise the returned value will be the empty string.
  /// The ok return value reports whether the value was explicitly set in
  /// the tag string. If the tag does not have the conventional format,
  /// the value returned by Lookup is unspecified.
  fn Lookup(self, key: string) -> Option<string>
}

impl Value {
  /// Addr returns a pointer value representing the address of v.
  /// It panics if [Value.CanAddr] returns false.
  /// Addr is typically used to obtain a pointer to a struct field
  /// or slice element in order to call a method that requires a
  /// pointer receiver.
  fn Addr(self) -> Value

  /// Bool returns v's underlying value.
  /// It panics if v's kind is not [Bool].
  fn Bool(self) -> bool

  /// Bytes returns v's underlying value.
  /// It panics if v's underlying value is not a slice of bytes or
  /// an addressable array of bytes.
  fn Bytes(self) -> Slice<uint8>

  /// Call calls the function v with the input arguments in.
  /// For example, if len(in) == 3, v.Call(in) represents the Go call v(in[0], in[1], in[2]).
  /// Call panics if v's Kind is not [Func].
  /// It returns the output results as Values.
  /// As in Go, each input argument must be assignable to the
  /// type of the function's corresponding input parameter.
  /// If v is a variadic function, Call creates the variadic slice parameter
  /// itself, copying in the corresponding values.
  fn Call(self, in_: Slice<Value>) -> Slice<Value>

  /// CallSlice calls the variadic function v with the input arguments in,
  /// assigning the slice in[len(in)-1] to v's final variadic argument.
  /// For example, if len(in) == 3, v.CallSlice(in) represents the Go call v(in[0], in[1], in[2]...).
  /// CallSlice panics if v's Kind is not [Func] or if v is not variadic.
  /// It returns the output results as Values.
  /// As in Go, each input argument must be assignable to the
  /// type of the function's corresponding input parameter.
  fn CallSlice(self, in_: Slice<Value>) -> Slice<Value>

  /// CanAddr reports whether the value's address can be obtained with [Value.Addr].
  /// Such values are called addressable. A value is addressable if it is
  /// an element of a slice, an element of an addressable array,
  /// a field of an addressable struct, or the result of dereferencing a pointer.
  /// If CanAddr returns false, calling [Value.Addr] will panic.
  fn CanAddr(self) -> bool

  /// CanComplex reports whether [Value.Complex] can be used without panicking.
  fn CanComplex(self) -> bool

  /// CanConvert reports whether the value v can be converted to type t.
  /// If v.CanConvert(t) returns true then v.Convert(t) will not panic.
  fn CanConvert(self, t: Type) -> bool

  /// CanFloat reports whether [Value.Float] can be used without panicking.
  fn CanFloat(self) -> bool

  /// CanInt reports whether Int can be used without panicking.
  fn CanInt(self) -> bool

  /// CanInterface reports whether [Value.Interface] can be used without panicking.
  fn CanInterface(self) -> bool

  /// CanSet reports whether the value of v can be changed.
  /// A [Value] can be changed only if it is addressable and was not
  /// obtained by the use of unexported struct fields.
  /// If CanSet returns false, calling [Value.Set] or any type-specific
  /// setter (e.g., [Value.SetBool], [Value.SetInt]) will panic.
  fn CanSet(self) -> bool

  /// CanUint reports whether [Value.Uint] can be used without panicking.
  fn CanUint(self) -> bool

  /// Cap returns v's capacity.
  /// It panics if v's Kind is not [Array], [Chan], [Slice] or pointer to [Array].
  fn Cap(self) -> int

  /// Clear clears the contents of a map or zeros the contents of a slice.
  /// 
  /// It panics if v's Kind is not [Map] or [Slice].
  fn Clear(self)

  /// Close closes the channel v.
  /// It panics if v's Kind is not [Chan] or
  /// v is a receive-only channel.
  fn Close(self)

  /// Comparable reports whether the value v is comparable.
  /// If the type of v is an interface, this checks the dynamic type.
  /// If this reports true then v.Interface() == x will not panic for any x,
  /// nor will v.Equal(u) for any Value u.
  fn Comparable(self) -> bool

  /// Complex returns v's underlying value, as a complex128.
  /// It panics if v's Kind is not [Complex64] or [Complex128]
  fn Complex(self) -> complex128

  /// Convert returns the value v converted to type t.
  /// If the usual Go conversion rules do not allow conversion
  /// of the value v to type t, or if converting v to type t panics, Convert panics.
  fn Convert(self, t: Type) -> Value

  /// Elem returns the value that the interface v contains
  /// or that the pointer v points to.
  /// It panics if v's Kind is not [Interface] or [Pointer].
  /// It returns the zero Value if v is nil.
  fn Elem(self) -> Value

  /// Equal reports true if v is equal to u.
  /// For two invalid values, Equal will report true.
  /// For an interface value, Equal will compare the value within the interface.
  /// Otherwise, If the values have different types, Equal will report false.
  /// Otherwise, for arrays and structs Equal will compare each element in order,
  /// and report false if it finds non-equal elements.
  /// During all comparisons, if values of the same type are compared,
  /// and the type is not comparable, Equal will panic.
  fn Equal(self, u: Value) -> bool

  /// Field returns the i'th field of the struct v.
  /// It panics if v's Kind is not [Struct] or i is out of range.
  fn Field(self, i: int) -> Value

  /// FieldByIndex returns the nested field corresponding to index.
  /// It panics if evaluation requires stepping through a nil
  /// pointer or a field that is not a struct.
  fn FieldByIndex(self, index: Slice<int>) -> Value

  /// FieldByIndexErr returns the nested field corresponding to index.
  /// It returns an error if evaluation requires stepping through a nil
  /// pointer, but panics if it must step through a field that
  /// is not a struct.
  fn FieldByIndexErr(self, index: Slice<int>) -> Result<Value, error>

  /// FieldByName returns the struct field with the given name.
  /// It returns the zero Value if no field was found.
  /// It panics if v's Kind is not [Struct].
  fn FieldByName(self, name: string) -> Value

  /// FieldByNameFunc returns the struct field with a name
  /// that satisfies the match function.
  /// It panics if v's Kind is not [Struct].
  /// It returns the zero Value if no field was found.
  fn FieldByNameFunc(self, match_: fn(string) -> bool) -> Value

  /// Float returns v's underlying value, as a float64.
  /// It panics if v's Kind is not [Float32] or [Float64]
  fn Float(self) -> float64

  /// Grow increases the slice's capacity, if necessary, to guarantee space for
  /// another n elements. After Grow(n), at least n elements can be appended
  /// to the slice without another allocation.
  /// 
  /// It panics if v's Kind is not a [Slice], or if n is negative or too large to
  /// allocate the memory, or if [Value.CanSet] returns false.
  fn Grow(self, n: int)

  /// Index returns v's i'th element.
  /// It panics if v's Kind is not [Array], [Slice], or [String] or i is out of range.
  fn Index(self, i: int) -> Value

  /// Int returns v's underlying value, as an int64.
  /// It panics if v's Kind is not [Int], [Int8], [Int16], [Int32], or [Int64].
  fn Int(self) -> int64

  /// Interface returns v's current value as an interface{}.
  /// It is equivalent to:
  /// 
  /// 	var i interface{} = (v's underlying value)
  /// 
  /// It panics if the Value was obtained by accessing
  /// unexported struct fields.
  fn Interface(self) -> Unknown

  /// InterfaceData returns a pair of unspecified uintptr values.
  /// It panics if v's Kind is not Interface.
  /// 
  /// In earlier versions of Go, this function returned the interface's
  /// value as a uintptr pair. As of Go 1.4, the implementation of
  /// interface values precludes any defined use of InterfaceData.
  /// 
  /// Deprecated: The memory representation of interface values is not
  /// compatible with InterfaceData.
  #[go(array_return)]
  fn InterfaceData(self) -> Slice<uint>

  /// IsNil reports whether its argument v is nil. The argument must be
  /// a chan, func, interface, map, pointer, or slice value; if it is
  /// not, IsNil panics. Note that IsNil is not always equivalent to a
  /// regular comparison with nil in Go. For example, if v was created
  /// by calling [ValueOf] with an uninitialized interface variable i,
  /// i==nil will be true but v.IsNil will panic as v will be the zero
  /// Value.
  fn IsNil(self) -> bool

  /// IsValid reports whether v represents a value.
  /// It returns false if v is the zero Value.
  /// If [Value.IsValid] returns false, all other methods except String panic.
  /// Most functions and methods never return an invalid Value.
  /// If one does, its documentation states the conditions explicitly.
  fn IsValid(self) -> bool

  /// IsZero reports whether v is the zero value for its type.
  /// It panics if the argument is invalid.
  fn IsZero(self) -> bool

  /// Kind returns v's Kind.
  /// If v is the zero Value ([Value.IsValid] returns false), Kind returns Invalid.
  fn Kind(self) -> Kind

  /// Len returns v's length.
  /// It panics if v's Kind is not [Array], [Chan], [Map], [Slice], [String], or pointer to [Array].
  fn Len(self) -> int

  /// MapIndex returns the value associated with key in the map v.
  /// It panics if v's Kind is not [Map].
  /// It returns the zero Value if key is not found in the map or if v represents a nil map.
  /// As in Go, the key's value must be assignable to the map's key type.
  fn MapIndex(self, key: Value) -> Value

  /// MapKeys returns a slice containing all the keys present in the map,
  /// in unspecified order.
  /// It panics if v's Kind is not [Map].
  /// It returns an empty slice if v represents a nil map.
  fn MapKeys(self) -> Slice<Value>

  /// MapRange returns a range iterator for a map.
  /// It panics if v's Kind is not [Map].
  /// 
  /// Call [MapIter.Next] to advance the iterator, and [MapIter.Key]/[MapIter.Value] to access each entry.
  /// [MapIter.Next] returns false when the iterator is exhausted.
  /// MapRange follows the same iteration semantics as a range statement.
  /// 
  /// Example:
  /// 
  /// 	iter := reflect.ValueOf(m).MapRange()
  /// 	for iter.Next() {
  /// 		k := iter.Key()
  /// 		v := iter.Value()
  /// 		...
  /// 	}
  fn MapRange(self) -> Ref<MapIter>

  /// Method returns a function value corresponding to v's i'th method.
  /// The arguments to a Call on the returned function should not include
  /// a receiver; the returned function will always use v as the receiver.
  /// Method panics if i is out of range or if v is a nil interface value.
  /// 
  /// Calling this method will force the linker to retain all exported methods in all packages.
  /// This may make the executable binary larger but will not affect execution time.
  fn Method(self, i: int) -> Value

  /// MethodByName returns a function value corresponding to the method
  /// of v with the given name.
  /// The arguments to a Call on the returned function should not include
  /// a receiver; the returned function will always use v as the receiver.
  /// It returns the zero Value if no method was found.
  /// 
  /// Calling this method will cause the linker to retain all methods with this name in all packages.
  /// If the linker can't determine the name, it will retain all exported methods.
  /// This may make the executable binary larger but will not affect execution time.
  fn MethodByName(self, name: string) -> Value

  /// NumField returns the number of fields in the struct v.
  /// It panics if v's Kind is not [Struct].
  fn NumField(self) -> int

  /// NumMethod returns the number of methods in the value's method set.
  /// 
  /// For a non-interface type, it returns the number of exported methods.
  /// 
  /// For an interface type, it returns the number of exported and unexported methods.
  fn NumMethod(self) -> int

  /// OverflowComplex reports whether the complex128 x cannot be represented by v's type.
  /// It panics if v's Kind is not [Complex64] or [Complex128].
  fn OverflowComplex(self, x: complex128) -> bool

  /// OverflowFloat reports whether the float64 x cannot be represented by v's type.
  /// It panics if v's Kind is not [Float32] or [Float64].
  fn OverflowFloat(self, x: float64) -> bool

  /// OverflowInt reports whether the int64 x cannot be represented by v's type.
  /// It panics if v's Kind is not [Int], [Int8], [Int16], [Int32], or [Int64].
  fn OverflowInt(self, x: int64) -> bool

  /// OverflowUint reports whether the uint64 x cannot be represented by v's type.
  /// It panics if v's Kind is not [Uint], [Uintptr], [Uint8], [Uint16], [Uint32], or [Uint64].
  fn OverflowUint(self, x: uint64) -> bool

  /// Pointer returns v's value as a uintptr.
  /// It panics if v's Kind is not [Chan], [Func], [Map], [Pointer], [Slice], [String], or [UnsafePointer].
  /// 
  /// If v's Kind is [Func], the returned pointer is an underlying
  /// code pointer, but not necessarily enough to identify a
  /// single function uniquely. The only guarantee is that the
  /// result is zero if and only if v is a nil func Value.
  /// 
  /// If v's Kind is [Slice], the returned pointer is to the first
  /// element of the slice. If the slice is nil the returned value
  /// is 0.  If the slice is empty but non-nil the return value is non-zero.
  /// 
  /// If v's Kind is [String], the returned pointer is to the first
  /// element of the underlying bytes of string.
  /// 
  /// It's preferred to use uintptr(Value.UnsafePointer()) to get the equivalent result.
  fn Pointer(self) -> uint

  /// Recv receives and returns a value from the channel v.
  /// It panics if v's Kind is not [Chan].
  /// The receive blocks until a value is ready.
  /// The boolean value ok is true if the value x corresponds to a send
  /// on the channel, false if it is a zero value received because the channel is closed.
  fn Recv(self) -> Option<Value>

  /// Send sends x on the channel v.
  /// It panics if v's kind is not [Chan] or if x's type is not the same type as v's element type.
  /// As in Go, x's value must be assignable to the channel's element type.
  fn Send(self, x: Value)

  /// Seq returns an iter.Seq[Value] that loops over the elements of v.
  /// If v's kind is Func, it must be a function that has no results and
  /// that takes a single argument of type func(T) bool for some type T.
  /// If v's kind is Pointer, the pointer element type must have kind Array.
  /// Otherwise v's kind must be Int, Int8, Int16, Int32, Int64,
  /// Uint, Uint8, Uint16, Uint32, Uint64, Uintptr,
  /// Array, Chan, Map, Slice, or String.
  fn Seq(self) -> iter.Seq<Value>

  /// Seq2 returns an iter.Seq2[Value, Value] that loops over the elements of v.
  /// If v's kind is Func, it must be a function that has no results and
  /// that takes a single argument of type func(K, V) bool for some type K, V.
  /// If v's kind is Pointer, the pointer element type must have kind Array.
  /// Otherwise v's kind must be Array, Map, Slice, or String.
  fn Seq2(self) -> iter.Seq2<Value, Value>

  /// Set assigns x to the value v.
  /// It panics if [Value.CanSet] returns false.
  /// As in Go, x's value must be assignable to v's type and
  /// must not be derived from an unexported field.
  fn Set(self, x: Value)

  /// SetBool sets v's underlying value.
  /// It panics if v's Kind is not [Bool] or if [Value.CanSet] returns false.
  fn SetBool(self, x: bool)

  /// SetBytes sets v's underlying value.
  /// It panics if v's underlying value is not a slice of bytes
  /// or if [Value.CanSet] returns false.
  fn SetBytes(self, x: Slice<uint8>)

  /// SetCap sets v's capacity to n.
  /// It panics if v's Kind is not [Slice], or if n is smaller than the length or
  /// greater than the capacity of the slice,
  /// or if [Value.CanSet] returns false.
  fn SetCap(self, n: int)

  /// SetComplex sets v's underlying value to x.
  /// It panics if v's Kind is not [Complex64] or [Complex128],
  /// or if [Value.CanSet] returns false.
  fn SetComplex(self, x: complex128)

  /// SetFloat sets v's underlying value to x.
  /// It panics if v's Kind is not [Float32] or [Float64],
  /// or if [Value.CanSet] returns false.
  fn SetFloat(self, x: float64)

  /// SetInt sets v's underlying value to x.
  /// It panics if v's Kind is not [Int], [Int8], [Int16], [Int32], or [Int64],
  /// or if [Value.CanSet] returns false.
  fn SetInt(self, x: int64)

  /// SetIterKey assigns to v the key of iter's current map entry.
  /// It is equivalent to v.Set(iter.Key()), but it avoids allocating a new Value.
  /// As in Go, the key must be assignable to v's type and
  /// must not be derived from an unexported field.
  /// It panics if [Value.CanSet] returns false.
  fn SetIterKey(self, iter: Ref<MapIter>)

  /// SetIterValue assigns to v the value of iter's current map entry.
  /// It is equivalent to v.Set(iter.Value()), but it avoids allocating a new Value.
  /// As in Go, the value must be assignable to v's type and
  /// must not be derived from an unexported field.
  /// It panics if [Value.CanSet] returns false.
  fn SetIterValue(self, iter: Ref<MapIter>)

  /// SetLen sets v's length to n.
  /// It panics if v's Kind is not [Slice], or if n is negative or
  /// greater than the capacity of the slice,
  /// or if [Value.CanSet] returns false.
  fn SetLen(self, n: int)

  /// SetMapIndex sets the element associated with key in the map v to elem.
  /// It panics if v's Kind is not [Map].
  /// If elem is the zero Value, SetMapIndex deletes the key from the map.
  /// Otherwise if v holds a nil map, SetMapIndex will panic.
  /// As in Go, key's elem must be assignable to the map's key type,
  /// and elem's value must be assignable to the map's elem type.
  fn SetMapIndex(self, key: Value, elem: Value)

  /// SetPointer sets the [unsafe.Pointer] value v to x.
  /// It panics if v's Kind is not [UnsafePointer]
  /// or if [Value.CanSet] returns false.
  fn SetPointer(self, x: Unknown)

  /// SetString sets v's underlying value to x.
  /// It panics if v's Kind is not [String] or if [Value.CanSet] returns false.
  fn SetString(self, x: string)

  /// SetUint sets v's underlying value to x.
  /// It panics if v's Kind is not [Uint], [Uintptr], [Uint8], [Uint16], [Uint32], or [Uint64],
  /// or if [Value.CanSet] returns false.
  fn SetUint(self, x: uint64)

  /// SetZero sets v to be the zero value of v's type.
  /// It panics if [Value.CanSet] returns false.
  fn SetZero(self)

  /// Slice returns v[i:j].
  /// It panics if v's Kind is not [Array], [Slice] or [String], or if v is an unaddressable array,
  /// or if the indexes are out of bounds.
  fn Slice(self, i: int, j: int) -> Value

  /// Slice3 is the 3-index form of the slice operation: it returns v[i:j:k].
  /// It panics if v's Kind is not [Array] or [Slice], or if v is an unaddressable array,
  /// or if the indexes are out of bounds.
  fn Slice3(self, i: int, j: int, k: int) -> Value

  /// String returns the string v's underlying value, as a string.
  /// String is a special case because of Go's String method convention.
  /// Unlike the other getters, it does not panic if v's Kind is not [String].
  /// Instead, it returns a string of the form "<T value>" where T is v's type.
  /// The fmt package treats Values specially. It does not call their String
  /// method implicitly but instead prints the concrete values they hold.
  fn String(self) -> string

  /// TryRecv attempts to receive a value from the channel v but will not block.
  /// It panics if v's Kind is not [Chan].
  /// If the receive delivers a value, x is the transferred value and ok is true.
  /// If the receive cannot finish without blocking, x is the zero Value and ok is false.
  /// If the channel is closed, x is the zero value for the channel's element type and ok is false.
  fn TryRecv(self) -> Option<Value>

  /// TrySend attempts to send x on the channel v but will not block.
  /// It panics if v's Kind is not [Chan].
  /// It reports whether the value was sent.
  /// As in Go, x's value must be assignable to the channel's element type.
  fn TrySend(self, x: Value) -> bool

  /// Type returns v's type.
  fn Type(self) -> Type

  /// Uint returns v's underlying value, as a uint64.
  /// It panics if v's Kind is not [Uint], [Uintptr], [Uint8], [Uint16], [Uint32], or [Uint64].
  fn Uint(self) -> uint64

  /// UnsafeAddr returns a pointer to v's data, as a uintptr.
  /// It panics if v is not addressable.
  /// 
  /// It's preferred to use uintptr(Value.Addr().UnsafePointer()) to get the equivalent result.
  fn UnsafeAddr(self) -> uint

  /// UnsafePointer returns v's value as a [unsafe.Pointer].
  /// It panics if v's Kind is not [Chan], [Func], [Map], [Pointer], [Slice], [String] or [UnsafePointer].
  /// 
  /// If v's Kind is [Func], the returned pointer is an underlying
  /// code pointer, but not necessarily enough to identify a
  /// single function uniquely. The only guarantee is that the
  /// result is zero if and only if v is a nil func Value.
  /// 
  /// If v's Kind is [Slice], the returned pointer is to the first
  /// element of the slice. If the slice is nil the returned value
  /// is nil.  If the slice is empty but non-nil the return value is non-nil.
  /// 
  /// If v's Kind is [String], the returned pointer is to the first
  /// element of the underlying bytes of string.
  fn UnsafePointer(self) -> Unknown
}

impl ValueError {
  fn Error(self: Ref<ValueError>) -> string
}