Also changes truncate to use <=. It is a no-op in that case, but I'm thinking that doing the write in that case would improve branch prediction on this branch. I think that the vast majority of callers will always pass a length that is <= self.len().
As mentioned in https://github.com/tokio-rs/bytes/pull/699#pullrequestreview-2021892450.
Also changes
truncate
to use<=
. It is a no-op in that case, but I'm thinking that doing the write in that case would improve branch prediction on this branch. I think that the vast majority of callers will always pass a length that is<= self.len()
.cc @paolobarbolini