Debian Codegraph @

td/t_anchor_118.go

raw
1 // Copyright (c) 2023, Maxime Soulé
2 // All rights reserved.
3 //
4 // This source code is licensed under the BSD-style license found in the
5 // LICENSE file in the root directory of this source tree.
6
7 //go:build go1.18
8 // +build go1.18
9
10 package td
11
12 // Anchor is a generic shortcut to [T.Anchor].
13 //
14 // See also [T.AnchorT] method for a generic variant (go1.27 required).
15 func Anchor[X any](t *T, operator TestDeep) X {
16 t.Helper()
17 var model X
18 return t.Anchor(operator, model).(X)
19 }
20
21 // A is a generic shortcut to [T.A].
22 //
23 // See also [T.AT] method for a generic variant (go1.27 required).
24 func A[X any](t *T, operator TestDeep) X {
25 t.Helper()
26 var model X
27 return t.A(operator, model).(X)
28 }