@@ -9,28 +9,28 @@ func CastAssertion[SuperType any, Type any](a Assertion[SuperType]) Assertion[Ty
99 return cast [SuperType ](o )
1010 }
1111
12- return Lift (conversion , a )
12+ return Convert (conversion , a )
1313}
1414
15- // Lift converts from one assertion type to another by converting the tested value.
15+ // Convert converts from one assertion type to another by converting the tested value.
1616// It respectes the ObjectNameAssertion and ObjectNamespaceAssertion so that assertions
1717// can still be used to identify the object after lifting.
1818// The provided accessor can be fallible, returning false on the failure to convert the object.
19- func Lift [From any , To any ](accessor func (To ) (From , bool ), assertion Assertion [From ]) Assertion [To ] {
19+ func Convert [From any , To any ](accessor func (To ) (From , bool ), assertion Assertion [From ]) Assertion [To ] {
2020 if _ , ok := assertion .(ObjectNameAssertion ); ok {
21- return & liftedObjectName [From , To ]{liftedAssertion : liftedAssertion [From , To ]{accessor : accessor , assertion : assertion }}
21+ return & convertedObjectName [From , To ]{convertedAssertion : convertedAssertion [From , To ]{accessor : accessor , assertion : assertion }}
2222 } else if _ , ok := assertion .(ObjectNamespaceAssertion ); ok {
23- return & liftedObjectNamespace [From , To ]{liftedAssertion : liftedAssertion [From , To ]{accessor : accessor , assertion : assertion }}
23+ return & convertedObjectNamespace [From , To ]{convertedAssertion : convertedAssertion [From , To ]{accessor : accessor , assertion : assertion }}
2424 } else {
25- return & liftedAssertion [From , To ]{accessor : accessor , assertion : assertion }
25+ return & convertedAssertion [From , To ]{accessor : accessor , assertion : assertion }
2626 }
2727}
2828
29- // LiftAll performs Lift on all the provided assertions.
30- func LiftAll [From any , To any ](accessor func (To ) (From , bool ), assertions ... Assertion [From ]) Assertions [To ] {
29+ // ConvertAll performs Lift on all the provided assertions.
30+ func ConvertAll [From any , To any ](accessor func (To ) (From , bool ), assertions ... Assertion [From ]) Assertions [To ] {
3131 tos := make (Assertions [To ], len (assertions ))
3232 for i , a := range assertions {
33- tos [i ] = Lift (accessor , a )
33+ tos [i ] = Convert (accessor , a )
3434 }
3535 return tos
3636}
@@ -44,12 +44,12 @@ func cast[T any](obj any) (T, bool) {
4444 return ret , ok
4545}
4646
47- type liftedAssertion [From any , To any ] struct {
47+ type convertedAssertion [From any , To any ] struct {
4848 assertion Assertion [From ]
4949 accessor func (To ) (From , bool )
5050}
5151
52- func (lon * liftedAssertion [From , To ]) Test (t AssertT , obj To ) {
52+ func (lon * convertedAssertion [From , To ]) Test (t AssertT , obj To ) {
5353 t .Helper ()
5454 o , ok := lon .accessor (obj )
5555 if ! ok {
@@ -59,18 +59,18 @@ func (lon *liftedAssertion[From, To]) Test(t AssertT, obj To) {
5959 lon .assertion .Test (t , o )
6060}
6161
62- type liftedObjectName [From any , To any ] struct {
63- liftedAssertion [From , To ]
62+ type convertedObjectName [From any , To any ] struct {
63+ convertedAssertion [From , To ]
6464}
6565
66- func (lon * liftedObjectName [From , To ]) Name () string {
66+ func (lon * convertedObjectName [From , To ]) Name () string {
6767 return lon .assertion .(ObjectNameAssertion ).Name ()
6868}
6969
70- type liftedObjectNamespace [From any , To any ] struct {
71- liftedAssertion [From , To ]
70+ type convertedObjectNamespace [From any , To any ] struct {
71+ convertedAssertion [From , To ]
7272}
7373
74- func (lon * liftedObjectNamespace [From , To ]) Namespace () string {
74+ func (lon * convertedObjectNamespace [From , To ]) Namespace () string {
7575 return lon .assertion .(ObjectNamespaceAssertion ).Namespace ()
7676}
0 commit comments