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

tag! and byte arrays #54

Closed
niclashoyer opened this issue Jun 23, 2015 · 5 comments
Closed

tag! and byte arrays #54

niclashoyer opened this issue Jun 23, 2015 · 5 comments

Comments

@niclashoyer
Copy link

What is the correct way to use tag! with a fixed byte array? tag!([42u8, 42u8]) fails, as AsBytes is not implemented for [u8; 2].

@Geal
Copy link
Collaborator

Geal commented Jun 24, 2015

Well, you can do tag!(&[42u8, 42u8][..]) but it looks very ugly 😒

Could you wait a bit? I'm writing the AsBytes implementation for fixed length arrays.

@niclashoyer
Copy link
Author

Of course 😄
Is it true, that there is no simpler way than implementing the same method for every fixed size [T; 0], [T; 1], ...? At least it is done this way in std::array. Seems very tedious.

@Geal
Copy link
Collaborator

Geal commented Jun 24, 2015

There are lots of cases like this in language development, any time something has a fixed number of components, like tuples or function arguments.

Oddly, it is easier to handle an array of unknown length.

@Geal Geal closed this as completed in 8bce0ec Jun 24, 2015
@Geal
Copy link
Collaborator

Geal commented Jun 24, 2015

I just published nom 0.3.7, this should work now. Let me know if you need anything else!

@niclashoyer
Copy link
Author

works like a charm, thanks!

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