Skip to content

Conversation

@lightsing
Copy link
Contributor

This pull request introduces the implementation of the FromLua trait for serde_json::Value. This will allow smooth conversion from Lua values to serde_json values and get rid of the 'lua lifetime, providing better integration and flexibility.

Details:

  1. Added a new feature flag for json:
    A new feature flag named json has been added, dependent on both the serialize feature and the serde_json crate. This allows the conditional compilation of the new implementation, ensuring backward compatibility.

  2. Updated Cargo.toml:

    • Added serde_json as an optional dependency, with version "1.0".
  3. Updated src/value.rs:

    • Added an implementation block for FromLua trait for serde_json::Value.
    • Inside the from_lua method, a value of Lua type is converted to a serde_json::Value, handling any potential conversion errors and wrapping them into the Error::FromLuaConversionError.
@khvzak khvzak force-pushed the master branch 2 times, most recently from 94cef89 to 59b1400 Compare March 22, 2024 00:36
@khvzak khvzak force-pushed the master branch 4 times, most recently from 166f9c2 to f1ceaf0 Compare June 18, 2024 15:09
@ElhamAryanpur
Copy link

this is amazing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants