func MatchElementsWithIndex(identifier IdentifierWithIndex, options Options, elements Elements) types.GomegaMatcher {
	return &ElementsMatcher{
		Identifier:      identifier,
		Elements:        elements,
		IgnoreExtras:    options&IgnoreExtras != 0,
		IgnoreMissing:   options&IgnoreMissing != 0,
		AllowDuplicates: options&AllowDuplicates != 0,
	}
}
MatchElementsWithIndex succeeds if each element of a slice matches the element matcher it maps to
through the id with index function. It can ignore extra elements and/or missing elements.
idFn := func(index int, element interface{}) string {
return strconv.Itoa(index)
}

Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{
"0": Equal("a"),
"1": Equal("b"),
}))
Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{
"0": Equal("a"),
"1": Equal("b"),
"2": Equal("c"),
"3": Equal("d"),
}))
package gstruct
import (
	"errors"
	"fmt"
	"reflect"
	"runtime/debug"
	"strconv"
	"github.com/onsi/gomega/format"
	errorsutil "github.com/onsi/gomega/gstruct/errors"
	"github.com/onsi/gomega/types"
)
func MatchAllElements(identifier Identifier, elements Elements) types.GomegaMatcher {
	return &ElementsMatcher{
		Identifier: identifier,
		Elements:   elements,
	}
}
func MatchAllElementsWithIndex(identifier IdentifierWithIndex, elements Elements) types.GomegaMatcher {
	return &ElementsMatcher{
		Identifier: identifier,
		Elements:   elements,
	}
}
func MatchElements(identifier Identifier, options Options, elements Elements) types.GomegaMatcher {
	return &ElementsMatcher{
		Identifier:      identifier,
		Elements:        elements,
		IgnoreExtras:    options&IgnoreExtras != 0,
		IgnoreMissing:   options&IgnoreMissing != 0,
		AllowDuplicates: options&AllowDuplicates != 0,
	}
}