gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

constraints.go (1775B)


      1 // Copyright 2021 The Go Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style
      3 // license that can be found in the LICENSE file.
      4 
      5 // Package constraints defines a set of useful constraints to be used
      6 // with type parameters.
      7 package constraints
      8 
      9 // Signed is a constraint that permits any signed integer type.
     10 // If future releases of Go add new predeclared signed integer types,
     11 // this constraint will be modified to include them.
     12 type Signed interface {
     13 	~int | ~int8 | ~int16 | ~int32 | ~int64
     14 }
     15 
     16 // Unsigned is a constraint that permits any unsigned integer type.
     17 // If future releases of Go add new predeclared unsigned integer types,
     18 // this constraint will be modified to include them.
     19 type Unsigned interface {
     20 	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
     21 }
     22 
     23 // Integer is a constraint that permits any integer type.
     24 // If future releases of Go add new predeclared integer types,
     25 // this constraint will be modified to include them.
     26 type Integer interface {
     27 	Signed | Unsigned
     28 }
     29 
     30 // Float is a constraint that permits any floating-point type.
     31 // If future releases of Go add new predeclared floating-point types,
     32 // this constraint will be modified to include them.
     33 type Float interface {
     34 	~float32 | ~float64
     35 }
     36 
     37 // Complex is a constraint that permits any complex numeric type.
     38 // If future releases of Go add new predeclared complex numeric types,
     39 // this constraint will be modified to include them.
     40 type Complex interface {
     41 	~complex64 | ~complex128
     42 }
     43 
     44 // Ordered is a constraint that permits any ordered type: any type
     45 // that supports the operators < <= >= >.
     46 // If future releases of Go add new ordered types,
     47 // this constraint will be modified to include them.
     48 type Ordered interface {
     49 	Integer | Float | ~string
     50 }