File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -76,15 +76,40 @@ Returns the number of bytes used by the elements in the buffer.
76
76
say blob16.new([1, 2, 3]).bytes; # OUTPUT: «6»
77
77
say blob64.new([1, 2, 3]).bytes; # OUTPUT: «24»
78
78
79
+ = head2 method chars
80
+
81
+ Defined as:
82
+
83
+ method chars(Blob:D:)
84
+
85
+ Throws C < X::Buf::AsStr > with C < chars > as payload.
86
+
87
+ = head2 method Str
88
+
89
+ Defined as:
90
+
91
+ multi method Str(Blob:D:)
92
+
93
+ Throws C < X::Buf::AsStr > with C < Str > as payload. In order to convert to a C < Str >
94
+ you need to use L < C < .decode > |/routine/decode> .
95
+
96
+ = head2 method Stringy
97
+
98
+ Defined as:
99
+
100
+ multi method Stringy(Blob:D:)
101
+
102
+ Throws C < X::Buf::AsStr > with C < Stringy > as payload.
103
+
79
104
= head2 method decode
80
105
81
106
Defined as:
82
107
83
108
multi method decode(Blob:D: $encoding = self.encoding // "utf-8")
84
109
85
110
= for code :method
86
- multi method decode(Blob:D: $encoding, Str :$replacement!,
87
- Bool:D :$strict = False)
111
+ multi method decode(Blob:D: $encoding, Str :$replacement!,
112
+ Bool:D :$strict = False)
88
113
89
114
multi method decode(Blob:D: $encoding, Bool:D :$strict = False)
90
115
Original file line number Diff line number Diff line change 4
4
5
5
= SUBTITLE Mutable buffer for binary data
6
6
7
- role Buf[::T] does Blob[T] { ... }
7
+ role Buf[::T = uint8 ] does Blob[T] is repr('VMArray') is array_type(T) { ... }
8
8
9
- A C < Buf > is a mutable sequence of (usually unsigned) integers.
9
+ A C < Buf > does the role of a mutable sequence of (usually unsigned) integers.
10
10
11
11
my $b = Buf.new(1, 2, 3);
12
12
$b[1] = 42;
You can’t perform that action at this time.
0 commit comments