reflectiter

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

reflectiter defines iterator source/collector that corresponds to std library `reflect`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertValue

func AssertValue[V any](seq iter.Seq[reflect.Value]) iter.Seq[V]

AssertValue returns an iterator over seq but each value returned by reflect.Value.Interface is type-asserted to be type V.

func AssertValue2

func AssertValue2[K, V any](seq iter.Seq2[reflect.Value, reflect.Value]) iter.Seq2[K, V]

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

func Seq[V any](rv reflect.Value) iter.Seq[V]

Seq wraps reflect.Value.Seq with AssertValue.

func Seq2

func Seq2[K, V any](rv reflect.Value) iter.Seq2[K, V]

Seq2 wraps reflect.Value.Seq2 with AssertValue2.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL