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

schema: How to support niches like "byte array"? #147

Open
jamesmunns opened this issue May 13, 2024 · 3 comments
Open

schema: How to support niches like "byte array"? #147

jamesmunns opened this issue May 13, 2024 · 3 comments

Comments

@jamesmunns
Copy link
Owner

As we provide blanket trait impls for &[T] and [T; N], I'm not sure if there is a way to EVER produce a bytearray variant in the Schema derive.

This is likely to be the case until some kind of stable specialization is possible.

@dtolnay
Copy link
Contributor

dtolnay commented May 13, 2024

I don't think specialization needs to come into play for this. You can do the same thing that std::hash::Hash does, where there is a default behavior that goes with [Self], and the trait impl for u8 overrided it with a different behavior.

@jamesmunns
Copy link
Owner Author

Thanks @dtolnay! I'll need to look into that. Right now the base impls of the Schema trait are in the repo, but I'll go look at std::hash::Hash, if you have any links handy I'm happy to take a look.

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