func (t *T) AnchorsPersistTemporarily() func() {
	if t.DoAnchorsPersist() {
		return func() {}
	}
	t.SetAnchorsPersist(true)
	return func() {
		t.SetAnchorsPersist(false)
		t.Config.anchors.ResetAnchors(true)
	}
}
AnchorsPersistTemporarily is used by helpers to temporarily enable
anchors persistence. See tdhttp package for an example of use. It
returns a function to be deferred, to restore the normal behavior
(clear anchored operators if persistence was false, do nothing
otherwise).

Typically used as:
defer t.AnchorsPersistTemporarily()()
package td
import (
	"reflect"
	"sync"
	"github.com/maxatome/go-testdeep/internal/anchors"
	"github.com/maxatome/go-testdeep/internal/color"
)
var allAnchors = map[string]*anchors.Info{}
var allAnchorsMu sync.Mutex
func AddAnchorableStructType(fn interface{}) {
	err := anchors.AddAnchorableStructType(fn)
	if err != nil {
		panic(color.Bad(err.Error()))
	}
}
func (t *T) Anchor(operator TestDeep, model ...interface{}) interface{} {
	if operator == nil {
		t.Helper()
		t.Fatal(color.Bad("Cannot anchor a nil TestDeep operator"))
	}
	var typ reflect.Type
	if len(model) > 0 {
		if len(model) != 1 {
			t.Helper()
			t.Fatal(color.TooManyParams("Anchor(OPERATOR[, MODEL])"))
		}
		var ok bool
		typ, ok = model[0].(reflect.Type)
		if !ok {
			typ = reflect.TypeOf(model[0])
			if typ == nil {
				t.Helper()
				t.Fatal(color.Bad("Untyped nil value is not valid as model for an anchor"))
			}
		}
		typeBehind := operator.TypeBehind()
		if typeBehind != nil && typeBehind != typ {
			t.Helper()
			t.Fatal(color.Bad("Operator %s TypeBehind() returned %s which differs from model type %s. Omit model or ensure its type is %[2]s",
				operator.GetLocation().Func, typeBehind, typ))
		}
	} else {
		typ = operator.TypeBehind()
		if typ == nil {
			t.Helper()
			t.Fatal(color.Bad("Cannot anchor operator %s as TypeBehind() returned nil. Use model parameter to specify the type to return",
				operator.GetLocation().Func))
		}
	}
	nvm, err := t.Config.anchors.AddAnchor(typ, reflect.ValueOf(operator))
	if err != nil {
		t.Helper()
		t.Fatal(color.Bad(err.Error()))
	}
	return nvm.Interface()
}
func (t *T) A(operator TestDeep, model ...interface{}) interface{} {
	t.Helper()
	return t.Anchor(operator, model...)
}
func (t *T) resetNonPersistentAnchors() {
	t.Config.anchors.ResetAnchors(false)
}
func (t *T) ResetAnchors() {
	t.Config.anchors.ResetAnchors(true)
}