Skip to content

Conversation

@NobodyXu
Copy link

@NobodyXu NobodyXu commented Sep 29, 2025

Having a safe API for MaybeUninit<u8> would be necessary for async-compression to wrap and reduce the performance penalty of initializing the buffer for all tokio::io::* traits implementation.

@CLAassistant
Copy link

CLAassistant commented Sep 29, 2025

CLA assistant check
All committers have signed the CLA.

@danielrh
Copy link
Collaborator

danielrh commented Dec 3, 2025

I want to ensure that we have a safe-only version of all APIs so someone can compile without any unsafe calls. Can you refactor this so that the unsafe and safe codes are duplicated and that way someone can simply link in the safe calls or the unsafe calls but don't need to go through an unsafe block if they want a safe interface.

@NobodyXu
Copy link
Author

NobodyXu commented Dec 3, 2025

I could add a new type Buffer that:

enum Buffer<'a> {
    Uninit(&'a [MaybeUninit<u8>]),
    Init(&'a [u8]),
}

Then it'd be 100% free of unsafe. Does this look good to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants