allocate
ErrorsCollection

allocate

Synthesised documentation from type/Blob

From type/Blob

See Original text in context

multi method allocate(Blob:U: Int:D $elements)
multi method allocate(Blob:U: Int:D $elementsint $value)
multi method allocate(Blob:U: Int:D $elementsInt:D \value)
multi method allocate(Blob:U: Int:D $elementsMu:D $got)
multi method allocate(Blob:U: Int:D $elementsint @values)
multi method allocate(Blob:U: Int:D $elementsBlob: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.