Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

impl FromLua for serde_json::Value #302

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

Open
lightsing wants to merge 1 commit into mlua-rs:main
base: main
Choose a base branch
Loading
from vlegend-game:feat/serde_json

Conversation

@lightsing
Copy link
Contributor

@lightsing lightsing commented Aug 2, 2023

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.

alerque and kotatsuyaki reacted with thumbs up emoji
@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
Copy link

this is amazing

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /