Accepts parameters matching the types of the fields declared in the template arguments and automatically assigns values to the backing fields.
Deconstruction support for the <a href="/dext/dext/let">let module</a>.
Implements equality comparison with other records of the same type. Two records are only considered equal if all fields are equal.
Computes the hashcode of this record based on the hashes of the fields, as well as the field names to avoid collisions with other records with the same number and type of fields.
Stringifies and formats all fields.
1 // define a point int 2D space 2 alias Point = Record!( 3 int, "x", 4 int, "y" 5 ); 6 7 auto a = Point( 3, 7 ); 8 auto b = Point( 9, 6 ); 9 10 // Euclidean distance 11 auto distance( in Point a, in Point b ) 12 { 13 import std.math : sqrt; 14 15 return sqrt( ( a.x - b.x ) ^^ 2f + ( a.y - b.y ) ^^ 2f ); 16 } 17 18 auto dist = distance( a, b ); // 6.08276
MIT
Copyright © 2017, Tony J. Hudgins
Immutable value type that automatically implements equality (==, !=), hashcode computation (toHash), and stringification (toString). The purpose of this struct is act similarly to record types in functional programming languages like OCaml and Haskell.