Merge pull request #2708 from nspcc-dev/fix-it-doc

interop: adjust Iterator documentation
This commit is contained in:
Roman Khimov 2022-09-21 14:36:07 +07:00 committed by GitHub
commit 5eb4ba772f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,8 +6,8 @@ package iterator
import "github.com/nspcc-dev/neo-go/pkg/interop/neogointernal" import "github.com/nspcc-dev/neo-go/pkg/interop/neogointernal"
// Iterator represents a Neo iterator, it's an opaque data structure that can // Iterator represents a Neo iterator, it's an opaque data structure that can
// be properly created by Create or storage.Find. Iterators range over key-value // be properly created by storage.Find. Iterators range over key-value pairs,
// pairs, so it's convenient to use them for maps. This structure is similar in // so it's convenient to use them for maps. This structure is similar in
// function to Neo .net framework's Iterator. // function to Neo .net framework's Iterator.
type Iterator struct{} type Iterator struct{}
@ -22,7 +22,7 @@ func Next(it Iterator) bool {
// Value returns iterator's current value. It's only valid to call after // Value returns iterator's current value. It's only valid to call after
// a successful Next call. This function uses `System.Iterator.Value` syscall. // a successful Next call. This function uses `System.Iterator.Value` syscall.
// For slices, the result is just value. // For slices, the result is just value.
// For maps, the result can be casted to a slice of 2 elements: a key and a value. // For maps, the result can be cast to a slice of 2 elements: a key and a value.
// For storage iterators, refer to `storage.FindFlags` documentation. // For storage iterators, refer to `storage.FindFlags` documentation.
func Value(it Iterator) interface{} { func Value(it Iterator) interface{} {
return neogointernal.Syscall1("System.Iterator.Value", it) return neogointernal.Syscall1("System.Iterator.Value", it)