I'd like to use the bytes::cut() function. The doc reads:
// Returns the input slice "cut" along the first instance of a delimiter,
// returning everything up to the delimiter, and everything after the
delimiter,
// in a tuple. The contents are borrowed from the input slice.
//
// The caller must ensure that 'delimiter' is not an empty slice.
fn cut(in: []u8, delim: ([]u8 | u8)) ([]u8, []u8);
I noticed that I can't write something like:
let (hd, tail) = bytes::cut(contents, delim);
so I have to write something like
let tup = bytes::cut(contents, delim);
My question is: how do I access the parts of the tuple?
On Tue Nov 29, 2022 at 4:42 PM CET, Person wrote:
> I noticed that I can't write something like:>> let (hd, tail) = bytes::cut(contents, delim);
This should work, assuming your toolchain is up to date.
> so I have to write something like>> let tup = bytes::cut(contents, delim);>> My question is: how do I access the parts of the tuple?
tup.0, tup.1, etc