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

decoding bytes without pointer #4

Open
BrannonKing opened this issue Jul 28, 2021 · 2 comments
Open

decoding bytes without pointer #4

BrannonKing opened this issue Jul 28, 2021 · 2 comments

Comments

@BrannonKing
Copy link

It would be nice if there was a way to decode bytes without the pointer (as things like data[:]) don't work. For that overload, if there wasn't enough space in the slice, it would need to return an error instead of resizing the slice.

@itsmontoya
Copy link
Collaborator

This is a really interesting request! I think I might be able to work this in more soon. I'm currently working on a reflect-based schema builder. So that people can use enkodo without having to write the custom Marshal and Unmarshal methods

@BrannonKing
Copy link
Author

I was able to make it work by using a local var. It's not terrible:

id := c.ClaimID[:]
err := dec.Bytes(&id)
...

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