In role Blob§
See primary documentation in context for method allocate
multi method allocate(Blob:U: Int:D $elements) multi method allocate(Blob:U: Int:D $elements, int $value) multi method allocate(Blob:U: Int:D $elements, Int:D \value) multi method allocate(Blob:U: Int:D $elements, Mu:D $got) multi method allocate(Blob:U: Int:D $elements, int @values) multi method allocate(Blob:U: Int:D $elements, Blob:D $blob) multi method allocate(Blob:U: Int:D $elements, @values)
Returns a newly created Blob
object with the given number of elements. Optionally takes a second argument that indicates the pattern with which to fill the Blob
: this can be a single (possibly native) integer value, or any Iterable
that generates integer values, including another Blob
. The pattern will be repeated if not enough values are given to fill the entire Blob
.
my Blob $b0 = Blob.allocate(10,0); $b0.say; # OUTPUT: «Blob:0x<00 00 00 00 00 00 00 00 00 00>»
If the pattern is a general Mu
value, it will fail.