Skip to content

Commit

Permalink
Update the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ryo33 committed Feb 15, 2024
1 parent aaa5c72 commit cafad75
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chromiumoxide_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,10 @@ pub enum Message<T = CdpJsonEventMessage> {

// `#[serde(untagged)]` does not work correctly with serde_json and some numeric types in the schema,
// without activating `arbitrary_precision` feature of serde_json and using `serde_json::Number` instead of all usage of `f64` or else.
// For now, we use a `FromStr` trait to deserialize the message, instead of `Deserialize` with
// using `serde_json` to deserialize the message to `serde_json::Value` at first and then trying to
// deserialize both `Response` or `Event` from the `serde_json::Value`.
// For now, we implement the `FromStr` trait to deserialize the message in no additional allocation manner,
// instead of `Deserialize` with using `serde_json` to deserialize the message to `serde_json::Value` at first,
// and then trying to deserialize `Response` or `Event` from the `serde_json::Value`.
// This should be fine because it never be parsed as other formats than JSON in real use case.
// - https://github.com/serde-rs/serde/issues/2661
// Also, this has a win in error reporting compared to `untagged` because we can return the
// detailed error instead of just "did not match any variant of untagged enum".
Expand Down

0 comments on commit cafad75

Please sign in to comment.