Skip to content

Commit cac4619

Browse files
committed
Added usage statements for C<antipair>, C<value>, C<cmp>, C<fmt>, C<kv>,
and C<pairs>
1 parent 2d7c132 commit cac4619

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

lib/Type/Pair.pod

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ The immutable version of a C<Pair> is an C<Enum>.
2828
2929
=head2 method antipair
3030
31+
Defined as:
32+
3133
method antipair() returns Pair:D
3234
35+
Usage:
36+
37+
PAIR.antipair
38+
3339
Returns a new C<Pair> object with key and value exchanged.
3440
3541
my $p = (6 => 'Perl').antipair;
@@ -38,21 +44,39 @@ Returns a new C<Pair> object with key and value exchanged.
3844
3945
=head2 method value
4046
47+
Defined as:
48+
4149
multi method value(Pair:D:) is rw
4250
51+
Usage:
52+
53+
PAIR.value
54+
4355
Returns the I<value> part of the C<Pair>.
4456
4557
=head2 infix cmp
4658
59+
Defined as:
60+
4761
multi sub infix:<cmp>(Pair:D, Pair:D)
4862
63+
Usage:
64+
65+
PAIR1 cmp PAIR2
66+
4967
The type-agnostic comparator; compares two C<Pair>s. Compares first their
5068
I<key> parts, and then compares the I<value> parts if the keys are equal.
5169
5270
=head2 method fmt
5371
72+
Defined as:
73+
5474
multi method fmt(Pair:D:) returns Str:D
5575
76+
Usage:
77+
78+
PAIR.fmt(FORMATSTRING)
79+
5680
Takes a I<format string>, and returns a string the I<key> and I<value>
5781
parts of the C<Pair> formatted. Here's an example:
5882
@@ -64,17 +88,29 @@ For more about format strings, see L<sprintf>.
6488
6589
=head2 method kv
6690
91+
Defined as:
92+
6793
multi method kv(Pair:D:) returns List:D
6894
95+
Usage:
96+
97+
PAIR.kv
98+
6999
Returns a two-element C<List> with the I<key> and I<value> parts of
70100
C<Pair>, in that order. This method is a special case of the same-named
71101
method on C<Hash>, which returns all its entries as a list of keys and
72102
values.
73103
74104
=head2 method pairs
75105
106+
Defined as:
107+
76108
multi method pairs(Pair:D:)
77109
110+
Usage:
111+
112+
PAIR.pairs
113+
78114
Returns a list of one C<Pair>, namely this one.
79115
80116
=end pod

0 commit comments

Comments
 (0)