eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
367 stars 106 forks source link

Adjust serde derives on InternalError struct #196

Closed eminence closed 2 years ago

eminence commented 2 years ago

The optional backtrace feature is slightly problematic when deriving Serialize and Deserialize. By default, the backtrace crate doesn't support serde, but it has an optional feature to do so.

Ideally, this problem would be solved by adjusting the dependency in Cargo.toml:

[features]
serde1 = ["serde", "backtrace?/serde"]

But this syntax is only available in rust 1.60, while the MSRV for procfs is 1.48.

So the until we bump our MSRV, the backtrace field will be skiped for serialization. Since this type has a Default impl, we could in theory deserialize it, but that doesn't seem to make much sense, so the InternalError struct no longer derives Deserialize.

eminence commented 2 years ago

@arilou or @eliad-wiz -- would you mind reviewing this?

eminence commented 2 years ago

Thanks for the review!