core :: CString :: to_bytes_with_copy
Bytes
object from a copy of self
with len
as lengthIf len
is null, strlen will determine the length of the Bytes
# Creates a new `Bytes` object from a copy of `self` with `len` as length
#
# If `len` is null, strlen will determine the length of the Bytes
fun to_bytes_with_copy(len: nullable Int): Bytes do
if len == null then len = cstring_length
var nns = new CString(len)
copy_to(nns, len, 0, 0)
return new Bytes(nns, len, len)
end
lib/core/bytes.nit:1031,2--1039,4