=begin pod =TITLE class Pair class Pair is Enum { ... } Consists of two parts, a I and a I. Cs can be seen as the atomic units in Ces, and they are also used in conjunction with named arguments and parameters. X<:> X<< => >> X<:!> There are three syntaxes for Cs: 'key' => 'value' # this... :key # ...means the same as this :$foo # short for foo => $foo Variants of this are :key # same as key => True :!key # same as key => False The immutable version of a C is an C. =head1 Methods =head2 value multi method value(Pair:D:) is rw Returns the I part of the C. =head2 cmp multi sub infix:(Pair:D, Pair:D) The type-agnostic comparator; compares two Cs. Compares first their I parts, and then compares the I parts if the keys are equal. =head2 fmt multi method fmt(Pair:D:) returns Str:D Takes a I, and returns a string the I and I parts of the C formatted. Here's an example: my $pair = :Earth(1); say $pair.fmt("%s is %.3f AU away from the sun") # Prints "Earth is 1.000 AU away from the sun" For more about format strings, see L. =head2 kv multi method kv(Pair:D:) returns Parcel:D Returns a two-element C with the I and I parts o C, in that order. This method is a special case of the same-named method on C, which returns all its entries as a list of keys and values. =head2 pairs multi method pairs(Pair:D:) Returns a list of one C, namely this one. =end pod