tokio-rs / bytes

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

allow to construct BytesMut with custom alignment #601

Closed Wireless4024 closed 1 year ago

Wireless4024 commented 1 year ago

added BytesMut::with_capacity_aligned to allocate BytesMut with custom alignment

fix #600

Wireless4024 commented 1 year ago

Close for now. I have no idea to archive aligned drop and ensure share ref able to drop aligned yet. I'll reopen this pr later when I can do it.

If anyone have idea please comment :smile: .

JackKelly commented 5 months ago

My use-case is the same as yours, @Wireless4024: I need an aligned buffer to use O_DIRECT.

I just submitted PR #684, which gives one way in which it might be possible to create a Bytes with arbitrary alignment.