Skip to content

Conversation

n-lebel
Copy link
Contributor

@n-lebel n-lebel commented Sep 30, 2025

This PR changes the signatures of the serio::{Sink, Stream} traits slightly so that the types sent have to be Serialize + Deserialize. This is so we can add a Scribed decorator on top of serio channels which appends all messages to a transcript; that was difficult to do in the Stream case because there was no straightforward way to access the bytes of the message. I don't expect this to affect anything downstream since sent types are meant to be Serialize + Deserialize anyway, but open to other ideas.

@th4s
Copy link
Member

th4s commented Sep 30, 2025

Hmm, usually it makes sense to separate Serialize and Deserialize. Maybe you can introduce some sort of wrapper trait in your library like e.g. trait SerializeStream: Stream { ... } which attaches your required trait bounds in the trait methods which then just delegate to the Stream methods?

@sinui0
Copy link
Member

sinui0 commented Oct 17, 2025

Perhaps a better place to plug in would be through the Deserializer trait which does have access to the serialized data. I would like to avoid adding the Serialize bound to the receiving side, and vice versa.

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.

3 participants