Documentation
¶
Overview ¶
reflectiter defines iterator source/collector that corresponds to std library `reflect`.
Index ¶
- func AssertValue[V any](seq iter.Seq[reflect.Value]) iter.Seq[V]
- func AssertValue2[K, V any](seq iter.Seq2[reflect.Value, reflect.Value]) iter.Seq2[K, V]
- func Field(v any) iter.Seq2[reflect.StructField, reflect.Value]
- func FieldRv(rv reflect.Value) iter.Seq2[reflect.StructField, reflect.Value]
- func Seq[V any](rv reflect.Value) iter.Seq[V]
- func Seq2[K, V any](rv reflect.Value) iter.Seq2[K, V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertValue ¶
AssertValue returns an iterator over seq but each value returned by reflect.Value.Interface is type-asserted to be type V.
func AssertValue2 ¶
Assert2 returns an iterator over seq but internal values returned by reflect.Value.Interface of each key-value pair are type-asserted to be type K and V respectively.
func Field ¶
Field is like FieldRv but converts v to reflect.Value.
func FieldRv ¶
FieldRv returns an iterator over fields of struct value v. The iterator panics on invocation if v is not a struct or pointer to a struct value.
Calling reflect.Value.Interface will panic if the field is not exported. Callers are advised to check if the field is exported by reflect.StructField.IsExported.
func Seq ¶
Seq wraps reflect.Value.Seq with AssertValue.
func Seq2 ¶
Seq2 wraps reflect.Value.Seq2 with AssertValue2.
Types ¶
This section is empty.