Add serde implementation for error-stack#792
Add serde implementation for error-stack#792indietyp wants to merge 9 commits intohashintel:mainfrom indietyp:feature/serde
serde implementation for error-stack#792Conversation
|
This PR implements a hook-based serialization (like #794) and a new attachment kind for While Libraries could also enable the @TimDiekmann, what do you think? Keep both? Only keep |
|
The plan is to remove It's not possible, because |
|
I know that Therefore I will remove all code relating to I am pretty new to the concept of Would something like this be possible (with what you linked): trait SerializeImpl {
fn serialize(&self) -> Option<&dyn erased_serde::Serialize>;
}
unsafe trait FrameImpl: SerializeImpl {
...
}
impl<C> SerializeImpl for ContextFrame<C> where C: Context {
fn serialize(&self) -> Option<&dyn erased_serde::Serialize> {
None
}
}
impl<C> SerializeImpl for ContextFrame<C> where C: Context + serde::Serialize {
fn serialize(&self) -> Option<&dyn erased_serde::Serialize> {
Some(<dyn erased_serde::Serialize>::erase(self.context))
}
}
unsafe impl<C> FrameImpl for ContextFrame<C> where C: Context {
...
} |
error-stackserde implementation for error-stack
This PR was superseded by #1290
🌟 What is the purpose of this PR?
Create a
serdeimplementation forReportandFrame🔗 Related links
🚫 Blocked by
🔍 What does this change?
Report📜 Does this require a change to the docs?
Yes. The docs need to be updated to make users know that a serde serialization is provided.
🐾 Next steps
serdePR to implement json hook (follow up)🛡 What tests cover this?
❓ How to test this?
📹 Demo