bytes icon indicating copy to clipboard operation
bytes copied to clipboard

`const`-ify `BytesMut::len`, `BytesMut::is_empty`, and `BytesMut::capacity`,

Open Cyborus04 opened this issue 2 years ago • 4 comments

Cyborus04 avatar Nov 11 '21 17:11 Cyborus04

Is there a way to create BytesMut in const? If not, this does not seem to be available in practice.

taiki-e avatar Nov 11 '21 17:11 taiki-e

Ah, it was previously proposed, but I closed it for compatibility with future implementation changes. https://github.com/tokio-rs/bytes/pull/472#pullrequestreview-632946191

taiki-e avatar Nov 11 '21 17:11 taiki-e

I guess there isn't, you're right. I think new could be made const, but I'm not sure how useful that would be.

Cyborus04 avatar Nov 11 '21 17:11 Cyborus04

Ah, yep, haha

Cyborus04 avatar Nov 11 '21 17:11 Cyborus04