Skip to content

Custom Type serialization #1157

Answered by zeenix
Matthew-Skeer asked this question in Q&A
Nov 25, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Is that the only way, as the type is declared inside another library, which we dont really want to change.

Ah sorry, I missed that part. Yeah, the orphan rule won't allow you to implement external traits for external types. As usual, the solution is to either create a wrapper type in your code that implements the Type trait, or ask the implementation to be added to zvariant (but it has to be a type that's used a lot for that to be justified since we can't and won't provide implementations for every type on the planet).

BTW, this is a Rust question, not really zbus specific.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Matthew-Skeer
Comment options

@zeenix
Comment options

@zeenix
Comment options

Answer selected by zeenix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants