Skip to content

Add BrotliDecompressStreamUninit for uninitialized buffer#41

Open
NobodyXu wants to merge 1 commit into
dropbox:masterfrom
NobodyXu:patch-1
Open

Add BrotliDecompressStreamUninit for uninitialized buffer#41
NobodyXu wants to merge 1 commit into
dropbox:masterfrom
NobodyXu:patch-1

Conversation

@NobodyXu

@NobodyXu NobodyXu commented Sep 29, 2025

Copy link
Copy Markdown

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

CLAassistant commented Sep 29, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@danielrh

danielrh commented Dec 3, 2025

Copy link
Copy Markdown
Collaborator

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

NobodyXu commented Dec 3, 2025

Copy link
Copy Markdown
Author

I could add a new internal 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?

@danielrh

Copy link
Copy Markdown
Collaborator

That sounds possible--- as long as customers of the lib don't need to interact with it, it might let us reuse code better

@NobodyXu

Copy link
Copy Markdown
Author

Got it, I would do the refactor sfter New Years Eve.

Happy New Year Eve everyone!

@danielrh

Copy link
Copy Markdown
Collaborator

any luck here on the refactor?

@NobodyXu

Copy link
Copy Markdown
Author

Oops thanks for pinging, I lost track of this over time, would try to find some time to work on it

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