Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl FromLua for serde_json::Value #302

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants