We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I've been experimenting with karmem and I found that it would be useful to have an interface to describe writeable structs, something like:
// Writable writes an encoded representation of the type to the underlying Writer. type Writable interface { WriteAsRoot(*Writer) (uint, error) }
This would help to create helper method to encode different type of generated structs, i.e. I have something like
func ToPtr(writable Writable, w *karmem.Writer ) (uint32, uint32) { if _, err := writable.WriteAsRoot(w); err != nil { panic(err) } buf := w.Bytes() ptr := &buf[0] unsafePtr := uintptr(unsafe.Pointer(ptr)) return uint32(unsafePtr), uint32(len(buf)) }
The text was updated successfully, but these errors were encountered:
I can send a PR if it make sense
Sorry, something went wrong.
[go] Add a Writable interface to ease the process to encode structs t…
bee1263
…o Writer inkeliz#100
No branches or pull requests
I've been experimenting with karmem and I found that it would be useful to have an interface to describe writeable structs, something like:
This would help to create helper method to encode different type of generated structs, i.e. I have something like
The text was updated successfully, but these errors were encountered: