github.com/alloyzeus/go-azfl@v0.0.0-20231220071816-9740126a2d07/azob/cloneable.go (about)

     1  package azob
     2  
     3  // CloneableAssert is an interface to assert that type implements
     4  // the method Clone that returns a copy of itself.
     5  //
     6  // This is interface is partial solution to the fact that Go doesn't
     7  // support covariance.
     8  type CloneableAssert[T any] interface {
     9  	// Clone returns a deep copy of the instance. Some types, like mutex and
    10  	// context, are not supposed to be copied.
    11  	Clone() T
    12  }