Documentation for method subbuf

Documentation for method subbuf, assembled from the following types:

role Blob

From Blob

(Blob) method subbuf

Defined as:

multi method subbuf(Int $fromInt $len = self.elems --> Blob:D)
multi method subbuf(Range $range --> Blob:D)

Extracts a part of the invocant buffer, starting from the index with elements $from, and taking $len elements (or less if the buffer is shorter), and creates a new buffer as the result.

say;    # OUTPUT: «Blob:0x<03 04 05 06>␤» 
say*-2);     # OUTPUT: «Blob:0x<09 0a>␤» 
say*-5,2);   # OUTPUT: «Blob:0x<06 07>␤» 

For convenience, also allows a Range to be specified to indicate which part of the invocant buffer you would like:

say;    # OUTPUT: «Blob:0x<03 04 05 06>␤»