package vals

import (
	
)

// KeysIterator wraps the IterateKeys method.
type KeysIterator interface {
	// IterateKeys calls the passed function with each key within the receiver.
	// The iteration is aborted if the function returns false.
	IterateKeys(func(v interface{}) bool)
}

type cannotIterateKeysOf struct{ kind string }

func ( cannotIterateKeysOf) () string {
	return "cannot iterate keys of " + .kind
}

// IterateKeys iterates the keys of the supplied value, calling the supplied
// function for each key. The function can return false to break the iteration.
// It is implemented for the Map type, StructMap types, and types satisfying the
// IterateKeyser interface. For these types, it always returns a nil error. For
// other types, it doesn't do anything and returns an error.
func ( interface{},  func(interface{}) bool) error {
	switch v := .(type) {
	case KeysIterator:
		.IterateKeys()
	case Map:
		for  := .Iterator(); .HasElem(); .Next() {
			,  := .Elem()
			if !() {
				break
			}
		}
	case StructMap:
		iterateKeysStructMap(, )
	case PseudoStructMap:
		iterateKeysStructMap(.Fields(), )
	default:
		return cannotIterateKeysOf{Kind()}
	}
	return nil
}

func ( StructMap,  func(interface{}) bool) {
	for ,  := range getStructMapInfo(reflect.TypeOf()).fieldNames {
		if  == "" {
			continue
		}
		if !() {
			break
		}
	}
}