tokio-rs / bytes

Utilities for working with bytes
MIT License
1.87k stars 278 forks source link

Unnecessary `Sized` constraint on `BufMut::put` method? #612

Open GrizzlT opened 1 year ago

GrizzlT commented 1 year ago

When using this crate I noticed that the BufMut::put method requires Self to be Sized.

This makes it difficult for me to use that function in ?Sized contexts for better optimizations. Is there a reason this trait bound is necessary?

I looked at BufMut::put and BufMut::put_slice and it seems that neither method uses functions that require Self: Sized while put does require Sized and put_slice does not. Could the trait bound be removed from the api?

ObsidianMinor commented 10 months ago

BufMut::put is generic, which means it can't be used in an unsized context anyway.