if inplace do return buffer[start .. count];
- out := str.{
- data = raw_alloc(allocator, count * sizeof(u8)),
- count = count - start,
- };
-
+ out := memory.make_slice(u8, count - start);
memory.copy(out.data, buffer.data + start, count - start);
return out;
}
if inplace do return buffer[start .. count];
- out := str.{
- data = raw_alloc(allocator, count * sizeof(u8)),
- count = count - start,
- };
-
+ out := memory.make_slice(u8, count - start);
memory.copy(out.data, buffer.data + start, count - start);
return out;
}
if inplace do return buffer[start .. count];
- out := str.{
- data = raw_alloc(allocator, count * sizeof(u8)),
- count = count - start,
- };
-
+ out := memory.make_slice(u8, count - start);
memory.copy(out.data, buffer.data + start, count - start);
return out;
}
strip_whitespace :: #match {
(s: ^str) { strip_leading_whitespace(s); strip_trailing_whitespace(s); },
- (s: str) { strip_leading_whitespace(s); strip_trailing_whitespace(s); },
+ (s: str) => s |> strip_leading_whitespace() |> strip_trailing_whitespace()
}
strip_leading_whitespace :: #match {