Nullable Variant Type (aka Algebraic Type).
Variant Type (aka Algebraic Type).
Validates that the result doesn't contain an error value.
Behaves as getMember but doesn't enforce at compile time that all types can be handled by the member visitor.
Behaves as match but doesn't enforce at compile time that all types can be handled by the visiting functions.
Behaves as matchMember but doesn't enforce at compile time that all types can be handled by the member visitor.
Behaves as visit but doesn't enforce at compile time that all types can be handled by the visiting functions.
Applies a member handler to the given Variant depending on the held type, ensuring that all types are handled by the visiting handler.
Applies a delegate or function to the given arguments depending on the held type, ensuring that all types are handled by the visiting functions.
Applies a member handler to the given Variant depending on the held type, ensuring that all types are handled by the visiting handler.
Behaves as getMember but doesn't enforce at compile time that all types can be handled by the member visitor.
Behaves as match but doesn't enforce at compile time that all types can be handled by the visiting functions.
Behaves as matchMember but doesn't enforce at compile time that all types can be handled by the member visitor.
Behaves as visit but doesn't enforce at compile time that all types can be handled by the visiting functions.
Behaves as getMember but doesn't enforce at compile time that all types can be handled by the member visitor.
Behaves as match but doesn't enforce at compile time that all types can be handled by the visiting functions.
Behaves as matchMember but doesn't enforce at compile time that all types can be handled by the member visitor.
Behaves as visit but doesn't enforce at compile time that all types can be handled by the visiting functions.
Applies a delegate or function to the given Variant depending on the held type, ensuring that all types are handled by the visiting functions.
The attribute is used to define a permanent member field in an anlgebraic type. Should applied to a field of the union passed to TaggedVariant.
The attribute is used in pair with algMeta to exclude the field from compression in toHash, opEquals, and opCmp methods.
The attribute is used in pair with algMeta to use the field as an error infomration. Usually it is a position marker in a file. The type should have scope const toString method.
Wrapper to denote an error value type.
Nullable Variant Type (aka Algebraic Type).
Wrapper to denote an error value type.
Gets subtype of algebraic with types for which isErr is true.
Gets subtype of algebraic without types for which isErr is true.
Tagged Variant Type (aka Tagged Algebraic Type).
Type set resolution template used to construct Algebraic .
Checks if T is a instance of Err or if it is annotated with reflectErr.
Checks if T is a Variant with at least one allowed type that satisfy isErr traits.
Strips out Err wrapper from the type.
Same as isNullable, but with support for custom alias this variants.
Same as isTaggedVariant, but with support for custom alias this variants.
Same as isVariant, but matches for alias this variant types (requires DMD FE 2.100.0 or later)
Checks if the type is instance of tagged Algebraic.
Checks if the type list is TypeSet.
Checks if the type is instance of Algebraic.
Variant and Nullable types
This module implements a discriminated union type (a.k.a. tagged union, algebraic type). Such types are useful for type-uniform binary interfaces, interfacing with scripting languages, and comfortable exploratory programming.
The module defines generic Algebraic type that contains a payload. The allowed types of the paylad are defined by the unordered TypeSet.
Algebraic template accepts two arguments: self type set id and a list of type sets.
Algebraic Aliases
Visitor Handlers
$(TR $(TDNW $(LREF visit)) $(TD Yes) $(TD N/A) $(TD No) $(TD No) $(TD 1+) $(TD No) $(TD )) $(TR $(TDNW $(LREF optionalVisit)) $(TD No) $(TD No) $(TD Yes) $(TD No) $(TD 1+) $(TD No) $(TD )) $(TR $(TDNW $(LREF autoVisit)) $(TD No) $(TD No) $(TD auto) $(TD No) $(TD 1+) $(TD No) $(TD )) $(TR $(TDNW $(LREF tryVisit)) $(TD No) $(TD Yes) $(TD No) $(TD No) $(TD 1+) $(TD No) $(TD ))
$(TR $(TDNW $(LREF match)) $(TD Yes) $(TD N/A) $(TD No) $(TD Yes) $(TD 0+) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF optionalMatch)) $(TD No) $(TD No) $(TD Yes) $(TD Yes) $(TD 0+) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF autoMatch)) $(TD No) $(TD No) $(TD auto) $(TD Yes) $(TD 0+) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF tryMatch)) $(TD No) $(TD Yes) $(TD No) $(TD Yes) $(TD 0+) $(TD Yes) $(TD ))
$(TR $(TDNW $(LREF suit)) $(TD N/A(Yes)) $(TD N/A) $(TD No) $(TD Yes) $(TD ?) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF some)) $(TD N/A(Yes)) $(TD N/A) $(TD No) $(TD Yes) $(TD 0+) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF none)) $(TD N/A(Yes)) $(TD N/A) $(TD No) $(TD Yes) $(TD 1+) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF assumeOk)) $(TD Yes(No)) $(TD No(Yes)) $(TD No(Yes)) $(TD Yes(No)) $(TD 0+) $(TD Yes(No)) $(TD ))
$(TR $(TDNW $(LREF getMember)) $(TD Yes) $(TD N/A) $(TD No) $(TD No) $(TD 1+) $(TD No) $(TD )) $(TR $(TDNW $(LREF optionalGetMember)) $(TD No) $(TD No) $(TD Yes) $(TD No) $(TD 1+) $(TD No) $(TD )) $(TR $(TDNW $(LREF autoGetMember)) $(TD No) $(TD No) $(TD auto) $(TD No) $(TD 1+) $(TD No) $(TD )) $(TR $(TDNW $(LREF tryGetMember)) $(TD No) $(TD Yes) $(TD No) $(TD No) $(TD 1+) $(TD No) $(TD ))
$(TR $(TDNW $(LREF matchMember)) $(TD Yes) $(TD N/A) $(TD No) $(TD No) $(TD 1+) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF optionalMatchMember)) $(TD No) $(TD No) $(TD Yes) $(TD No) $(TD 1+) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF autoMatchMember)) $(TD No) $(TD No) $(TD auto) $(TD No) $(TD 1+) $(TD Yes) $(TD )) $(TR $(TDNW $(LREF tryMatchMember)) $(TD No) $(TD Yes) $(TD No) $(TD No) $(TD 1+) $(TD Yes) $(TD ))
Special Types
$(TR $(TDNW <tt class="inline-code">void</tt>) $(TD It is usefull to indicate a possible return type of the visitor. Can't be accesed by reference.)) $(TR $(TDNW <tt class="inline-code">typeof(null)</tt>) $(TD It is usefull for nullable types. Also, it is used to indicate that a visitor can't match the current value of the algebraic. Can't be accesed by reference.))
$(TR $(TDNW <a class="xref" href="SetAlias.html">SetAlias</a><tt class="inline-code">!setId</tt>) $(TD Dummy structure that is used to construct cyclic-referencing lists of algebraic types.))
Algebraic Traits
method.