Package traits defines interfaces that a type may implement to participate in operator overloads and function dispatch.
const ( AdderType = 1 << iota ComparerType ContainerType DividerType FieldTesterType IndexerType IterableType IteratorType MatcherType ModderType MultiplierType NegatorType ReceiverType SizerType SubtractorType FoldableType )
This section is empty.
This section is empty.
Adder interface to support '+' operator overloads.
Comparer interface for ordering comparisons between values in order to support '<', '<=', '>=', '>' overloads.
type Container interface { Contains(value ref.Val) ref.Val }
Container interface which permits containment tests such as 'a in b'.
type Divider interface { Divide(denominator ref.Val) ref.Val }
Divider interface to support '/' operator overloads.
FieldTester indicates if a defined field on an object type is set to a non-default value.
For use with the `has()` macro.
type Foldable interface { Fold(Folder) }
Foldable aggregate types support iteration over (key, value) or (index, value) pairs.
type Folder interface { FoldEntry(key, val any) bool }
Folder performs a fold on a given entry and indicates whether to continue folding.
Indexer permits random access of elements by index 'a[b()]'.
type Iterable interface { Iterator() Iterator }
Iterable aggregate types permit traversal over their elements.
Iterator permits safe traversal over the contents of an aggregate type.
Lister interface which aggregates the traits of a list.
Mapper interface which aggregates the traits of a maps.
Matcher interface for supporting 'matches()' overloads.
type Modder interface { Modulo(denominator ref.Val) ref.Val }
Modder interface to support '%' operator overloads.
type Multiplier interface { Multiply(other ref.Val) ref.Val }
Multiplier interface to support '*' operator overloads.
type MutableLister interface { Lister ToImmutableList() Lister }
MutableLister interface which emits an immutable result after an intermediate computation.
Note, this interface is intended only to be used within Comprehensions where the mutable value is not directly observable within the user-authored CEL expression.
MutableMapper interface which emits an immutable result after an intermediate computation.
Note, this interface is intended only to be used within Comprehensions where the mutable value is not directly observable within the user-authored CEL expression.
type Negater interface { Negate() ref.Val }
Negater interface to support unary '-' and '!' operator overloads.
Receiver interface for routing instance method calls within a value.
type Sizer interface { Size() ref.Val }
Sizer interface for supporting 'size()' overloads.
type Subtractor interface { Subtract(subtrahend ref.Val) ref.Val }
Subtractor interface to support binary '-' operator overloads.
type Zeroer interface { IsZeroValue() bool }
Zeroer interface for testing whether a CEL value is a zero value for its type.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4