Skip to content

Commit eeee090

Browse files
committed
Add some basic documentation for the Encoding role
1 parent 110aac8 commit eeee090

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

doc/Type/Encoding.pod6

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
=begin pod
2+
3+
=TITLE role Encoding
4+
5+
=SUBTITLE ...
6+
7+
role Encoding { ... }
8+
9+
The C<Encoding> role is implemented by objects that provide a character
10+
encoding, such as ASCII or UTF-8. Besides being implemented by the built-in
11+
character encodings, it may also be implemented by users to provide new
12+
encodings. Instances of objects doing this role are typically obtained using
13+
C<Encoding::Registry>.
14+
15+
=head1 Methods
16+
17+
=head2 method name
18+
19+
method name({Encoding}:D: --> Str)
20+
21+
Gets the primary name of the encoding.
22+
23+
=head2 method alternative-names
24+
25+
method alternative-names({Encoding}:D: --> List)
26+
27+
Gets a list of alternative names for the encoding.
28+
29+
=head2 method decoder
30+
31+
method decoder({Encoding}:D: *%options --> Encoding::Decoder)
32+
33+
Gets a character decoder instance for this encoding, configured with the
34+
provided options. Options vary by encoding. The built-in encodings all
35+
support C<translate-nl>, which if C<True> will translate C<\r\n> into
36+
C<\n> while decoding.
37+
38+
=head2 method encoder
39+
40+
method encoder({Encoding}:D: *%options --> Encoding::Encoder)
41+
42+
Gets a character encoder instance for this encoding, configured with the
43+
provided options. Options vary by encoding. The built-in encodings all support
44+
both C<replacement> (either a C<Str> replacement sequence or C<True> to use a
45+
default replacement sequence for unencodable characters) and C<translate-nl>
46+
(when set to C<True>, turns C<\n> into C<\r\n> if the current platform is
47+
Windows).
48+
49+
=end pod
50+
51+
# vim: expandtab shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)