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

[API] Allow non-sized writers to be used by serialize_into #4

Merged
merged 3 commits into from
May 18, 2021
Merged

[API] Allow non-sized writers to be used by serialize_into #4

merged 3 commits into from
May 18, 2021

Conversation

ma2bd
Copy link
Contributor

@ma2bd ma2bd commented May 18, 2021

Slightly generalize the interface serialize_into<W, T> by allowing W: ?Sized.

I came across this issue while trying to write a trait like this one:

trait Writable {
    fn write(&self, writer: &mut dyn std::io::Write) -> Result<()>;
    // ^-- A BCS-based implementation would want to call serialize_into(writer, self)
}

(although there are alternative solutions such as trait Writable<W: std::io::Write>)

@ma2bd ma2bd requested a review from bmwill May 18, 2021 20:51
@ma2bd ma2bd changed the title [API] Writer not sized [API] Allow non-sized writers in serialize_into May 18, 2021
@ma2bd ma2bd changed the title [API] Allow non-sized writers in serialize_into [API] Allow non-sized writers to be used by serialize_into May 18, 2021
Copy link
Contributor

@bmwill bmwill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect you'll do a release once this lands?

@ma2bd
Copy link
Contributor Author

ma2bd commented May 18, 2021

I suspect you'll do a release once this lands?

Yes, that was my intention.

@ma2bd ma2bd merged commit 937ca76 into diem:master May 18, 2021
@ma2bd ma2bd deleted the writer_not_sized branch May 18, 2021 23:14
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

Successfully merging this pull request may close these issues.

2 participants