Sha256: bf9dfddec7c35dcbe1c8c3d76aac0983c4f9ca9ea65e434dfbb70c1461c0dceb

Contents?: true

Size: 720 Bytes

Versions: 5

Compression:

Stored size: 720 Bytes

Contents

// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// +build !go1.12

package impl

import "reflect"

type mapIter struct {
	v    reflect.Value
	keys []reflect.Value
}

// mapRange provides a less-efficient equivalent to
// the Go 1.12 reflect.Value.MapRange method.
func mapRange(v reflect.Value) *mapIter {
	return &mapIter{v: v}
}

func (i *mapIter) Next() bool {
	if i.keys == nil {
		i.keys = i.v.MapKeys()
	} else {
		i.keys = i.keys[1:]
	}
	return len(i.keys) > 0
}

func (i *mapIter) Key() reflect.Value {
	return i.keys[0]
}

func (i *mapIter) Value() reflect.Value {
	return i.v.MapIndex(i.keys[0])
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
planetscale-0.3.1 vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
planetscale-0.3.0 vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
planetscale-0.2.1 vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
planetscale-0.2.0 vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
planetscale-0.1.0 vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go