Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide APIs or mode that have similar non-panic guarantees to the untrusted crate #645

Closed
stackinspector opened this issue Dec 25, 2023 · 2 comments

Comments

@stackinspector
Copy link

stackinspector commented Dec 25, 2023

I found the untrusted crate and thought it was a good idea. I looked through the source code and there's no magic in it, it just encapsulates byte slices so that only APIs that won't be panic can be accessed, and no operations that may panic be done internally. But reading complex structures containing strings or byte strings from &[u8] either cannot avoid extra allocations or will get bunchs of issues about ownership. I'd like to have both benefits of Bytes's exemption from extra allocation, and untrusted's no-panic guarantee.
Similar points seems to be made in #254.

@seanmonstar
Copy link
Member

We can consolidate in #254.

@seanmonstar seanmonstar closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2023
@stackinspector
Copy link
Author

We can consolidate in #254.

and no operations that may panic be done internally

Not only at API level, but also including internal operations. Although API can also say "this operation will not be panic", it may be necessary to emphasize that. But anyway it's true that the discussion can be continued in #254.

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

No branches or pull requests

2 participants