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

Implement io.WriterTo for Message #266

Merged
merged 1 commit into from
Jul 15, 2022
Merged

Implement io.WriterTo for Message #266

merged 1 commit into from
Jul 15, 2022

Conversation

lthibault
Copy link
Collaborator

Partially addresses #259.

@zenhack ReadFrom is a bit tricker to implement because Decoder.Decode returns a *Message, and there's no obvious place to hook into. I'll leave that for a separate PR, but any insight would be most welcome.

@lthibault lthibault requested a review from zenhack July 15, 2022 14:00
@lthibault lthibault marked this pull request as ready for review July 15, 2022 14:00
@zenhack zenhack merged commit 80012bc into main Jul 15, 2022
@zenhack
Copy link
Contributor

zenhack commented Jul 15, 2022

Re: ReadFrom, you should just be able to assign the result to the receiver's referent, no?

func (m *Message) ReadFrom(...) ... {
    ...
    msg, err := dec.Decode()
    ...
    *m = *msg
    ...
}

@lthibault lthibault deleted the enhancement/msg-writerto branch July 15, 2022 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants