Closed Garmelon closed 1 year ago
advance
is part of trait Buf
, and is implemented on Bytes
here. Traits are always public, so as long as use bytes::Buf;
is in scope, you should be able to buf.advance(n)
as you described.
Oh, my bad. Sorry for the issue then. I relied too much on my editor which wasn't able to find Buf
because only Bytes
was reexported by axum, and when I searched in the cargo doc, I didn't think to ctrl+f advance
.
The
must_use
warning onBytes::split_to
suggests usingBytes::advance
if you don't need the returned value. However, that function is private since d8134903de1be93227ce376e1fb640ac2acfa8c1.It would be nice to be able to write
buf.advance(n)
instead oflet _ = buf.split_to(n)
.