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

feat: support From<&[u8; N]> for Bytes #683

Closed
wants to merge 1 commit into from

Conversation

cjwcommuny
Copy link

No description provided.

@braddunbar
Copy link
Contributor

Hey @cjwcommuny! Out of curiosity, are you having an issue using Bytes::copy_from_slice directly or is this about the convenience of calling from/into?

@cjwcommuny
Copy link
Author

cjwcommuny commented Mar 25, 2024

@braddunbar I would like to write a function like:

fn foo(x: impl Into<Bytes>) {}

foo(b"hello");
foo(Bytes::new());

I believe that implementing <&[u8; N]> for Bytes would improve the ergonomics.

@cjwcommuny
Copy link
Author

Hmmm... It seems that the "const generics" requires Rust 1.51+...

@Darksonn
Copy link
Contributor

Due to the const generics issue, we are unlikely to add this feature at this time.

@Darksonn Darksonn closed this Mar 25, 2024
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.

None yet

3 participants