Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
mir.annotated
Annotated value
License:
Authors:
Ilia Ki
- struct
Annotated(T); - A convenience definition of an annotated value.A structure that behaves like a recursive algebraic type should define enum _serdeRecursiveAlgebraic; member.Examples:
auto annotations = ["annotation"]; static struct S {double x;} auto as = Annotated!S(annotations, 5); assert(as.annotations == annotations); assert(as.value.x == 5); static struct C {double x;} auto ac = Annotated!S(annotations, 5); assert(ac.annotations == annotations); assert(ac.value.x == 5);
Examples:import mir.algebraic; auto annotations = ["annotation"]; static struct S {double x;} auto as = Annotated!(Variant!S)(annotations, 5); assert(as.annotations == annotations); assert(as.value.x == 5); static struct C {double x;} auto ac = Annotated!(Variant!S)(annotations, 5); assert(ac.annotations == annotations); assert(ac.value.x == 5);
- string[]
annotations; - inout @property ref inout(T)
value(); - @property ref T
value(Tvalue) return scope; - const bool
opEquals(scope const Annotatedrhs) scope; - pure @safe this(Args...)(string[]
annotations, Argsargs); - Parameters:
string[] annotationsnon-empty array of annotations Args argsarguments to construct value with - const pure nothrow @nogc @system int
opCmp()(scope const typeof(this)rhs) scope;
- struct
AnnotatedOnce(T); - A convenience definition of an annotated value.A structure that behaves like a recursive algebraic type should define enum _serdeRecursiveAlgebraic; member.Examples:
auto annotation = "annotation"; static struct S {double x;} auto as = AnnotatedOnce!S(annotation, 5); assert(as.annotation == annotation); assert(as.value.x == 5); static struct C {double x;} auto ac = AnnotatedOnce!S(annotation, 5); assert(ac.annotation == annotation); assert(ac.value.x == 5);
Examples:import mir.algebraic; auto annotation = "annotation"; static struct S {double x;} auto as = AnnotatedOnce!(Variant!S)(annotation, 5); assert(as.annotation == annotation); assert(as.value.x == 5); static struct C {double x;} auto ac = AnnotatedOnce!(Variant!S)(annotation, 5); assert(ac.annotation == annotation); assert(ac.value.x == 5);
- string
annotation; - inout @property ref inout(T)
value(); - @property ref T
value(Tvalue); - const bool
opEquals(scope const AnnotatedOncerhs) scope; - pure @safe this(Args...)(string
annotation, Argsargs); - Parameters:
string annotationnon-empty array of annotation Args argsarguments to construct value with - const pure nothrow @nogc @system int
opCmp()(scope const typeof(this)rhs) scope;
Copyright © 2016-2026 by Ilya Yaroshenko | Page generated by
Ddoc on Wed Apr 8 13:47:03 2026