@@ -19,11 +19,11 @@ Defined as:
19
19
multi method new(Blob: Blob:D $blob)
20
20
multi method new(Blob: int @values)
21
21
multi method new(Blob: @values)
22
- multi method new(Blob: *@values) {
22
+ multi method new(Blob: *@values)
23
23
24
24
25
- Creates an empty C < Blob > , or from another C < Blob > , from a list of integers or
26
- from a list of values
25
+ Creates an empty C < Blob > , or a new C < Blob > from another C < Blob > , or from a list
26
+ of integers or values (which will have to be coerced into integers):
27
27
28
28
my $blob = Blob.new([1, 2, 3]);
29
29
say Blob.new(<1 2 3>); # OUTPUT: «Blob:0x<01 02 03>»
@@ -130,18 +130,26 @@ part of the invocant buffer you would like:
130
130
131
131
Defined as:
132
132
133
- multi method allocate($elems --> Blob:D)
134
- multi method allocate($elems, $pattern --> Blob:D)
133
+ multi method allocate(Blob:U: Int:D $elements)
134
+ multi method allocate(Blob:U: Int:D $elements, int $value)
135
+ multi method allocate(Blob:U: Int:D $elements, Int:D \value)
136
+ multi method allocate(Blob:U: Int:D $elements, Mu:D $got)
137
+ multi method allocate(Blob:U: Int:D $elements, int @values)
138
+ multi method allocate(Blob:U: Int:D $elements, Blob:D $blob)
139
+ multi method allocate(Blob:U: Int:D $elements, @values)
135
140
136
141
Returns a newly created C < Blob > object with the given number of elements.
137
- Optionally takes a second argument that indicates the pattern with which to
138
- fill the C < Blob > : this can be a single integer value, or any C < Iterable >
139
- that generates integer values, including another C < Blob > . The pattern will be repeated if not enough
140
- values are given to fill the entire C < Blob > .
142
+ Optionally takes a second argument that indicates the pattern with which to fill
143
+ the C < Blob > : this can be a single (possibly native) integer value, or any
144
+ C < Iterable > that generates integer values, including another C < Blob > . The
145
+ pattern will be repeated if not enough values are given to fill the entire
146
+ C < Blob > .
141
147
142
148
my Blob $b0 = Blob.allocate(10,0);
143
149
$b0.say; # OUTPUT: «Blob:0x<00 00 00 00 00 00 00 00 00 00>»
144
150
151
+ If the pattern is a general C < Mu > value, it will fail.
152
+
145
153
= head2 method unpack
146
154
147
155
This method is considered B < experimental > , in order to use it you will need to
0 commit comments