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

Add owned String branch to deserialize_option_number_from_string #43

Merged
merged 2 commits into from
Apr 21, 2024

Conversation

andy128k
Copy link
Contributor

@andy128k andy128k commented Mar 28, 2024

This is somehow needed when I combine serde-aux with serde-dynamo.

Without this change I do have an error: "data did not match any variant of untagged enum NumericOrNull".

Summary by CodeRabbit

  • Refactor
    • Updated the deserialization logic to handle strings and string references differently, enhancing data handling capabilities.
    • Introducing a new variant String(String) to the NumericOrNull enum for improved data processing.

Copy link

coderabbitai bot commented Mar 28, 2024

Walkthrough

The project has embraced updates across its configuration and source code to support Rust version 1.61, marking a step forward in its development environment and compatibility. This includes adjustments in the CI workflow, nightly builds, and the library's version bump, alongside a notable enhancement in handling different data types within the codebase.

Changes

Files Change Summary
.github/workflows/... Updated the Rust version from 1.57.0 to 1.61.0 in CI and nightly build configurations.
Cargo.toml Incremented the library version to "4.5.1" and updated the Rust version requirement to "1.61".
README.md Documented support for Rust version 1.61 starting from library version 4.5.1.
src/field_attributes.rs Introduced a new String(String) variant to NumericOrNull enum, altering deserialization logic.

🐇✨
A leap to Rust, so bold and grand,
From 1.57 to 1.61, hand in hand.
In fields of code, where changes play,
A rabbit hops, leading the way.
🚀🎈
With each small hop, a new version born,
Under the moon and the rising dawn.
🌟🐾

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@andy128k andy128k marked this pull request as ready for review March 28, 2024 18:39
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6d0e9f0 and f4eafa6.
Files selected for processing (1)
  • src/field_attributes.rs (3 hunks)
Additional comments (4)
src/field_attributes.rs (4)
  • 404-404: The addition of the String(String) variant to the NumericOrNull enum is a significant enhancement. It allows for more flexible handling of string values during deserialization, particularly when converting between string representations and numeric types or identifying null values. This change aligns with the PR's objectives and improves the library's deserialization capabilities.
  • 414-417: The implementation of the String(String) variant in the deserialize_option_number_from_string function is correct and effectively handles the deserialization of owned string values. By matching against the String variant and performing a non-empty check before attempting to parse, the function ensures that empty strings are correctly interpreted as None, and non-empty strings are parsed into the desired numeric type if possible.
  • 440-451: The usage of the String(String) variant within the wrap_option_number_from_string_fn macro is consistent with its implementation in the deserialize_option_number_from_string function. This consistency is crucial for maintaining the expected behavior across different deserialization contexts that utilize this macro. The handling of empty and non-empty strings is appropriately managed, ensuring that the deserialization logic is robust and flexible.
  • 401-407: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

Consider organizing imports to improve readability. Grouping standard library imports together, followed by external crates, and then internal module imports can make the code easier to navigate and maintain.

src/field_attributes.rs Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f4eafa6 and 16b3cd0.
Files selected for processing (1)
  • src/field_attributes.rs (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/field_attributes.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6d0e9f0 and c4e9968.
Files selected for processing (1)
  • src/field_attributes.rs (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/field_attributes.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6d0e9f0 and 31e375d.
Files selected for processing (1)
  • src/field_attributes.rs (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/field_attributes.rs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6d0e9f0 and 2fe0bd0.
Files ignored due to path filters (1)
  • Cargo.toml is excluded by !**/*.toml
Files selected for processing (4)
  • .github/workflows/ci.yml (1 hunks)
  • .github/workflows/nightly.yml (1 hunks)
  • README.md (1 hunks)
  • src/field_attributes.rs (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/field_attributes.rs
Additional comments not posted (3)
README.md (1)

20-20: LGTM! It's good to see consistent documentation of Rust version support.

.github/workflows/ci.yml (1)

6-6: LGTM! Ensuring CI configurations match the documented Rust version support is crucial for consistency.

.github/workflows/nightly.yml (1)

8-8: LGTM! It's important to maintain consistency across all CI configurations with the project's Rust version support.

README.md Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6d0e9f0 and 18f1617.
Files selected for processing (5)
  • .github/workflows/ci.yml (1 hunks)
  • .github/workflows/nightly.yml (1 hunks)
  • Cargo.toml (1 hunks)
  • README.md (1 hunks)
  • src/field_attributes.rs (6 hunks)
Files skipped from review due to trivial changes (1)
  • Cargo.toml
Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/ci.yml
  • .github/workflows/nightly.yml
  • src/field_attributes.rs
Additional comments not posted (1)
README.md (1)

20-20: Consider adding a brief note explaining why the minimum Rust version was raised to 1.61, such as dependency requirements.

@iddm iddm merged commit 02470dd into iddm:master Apr 21, 2024
10 checks passed
@iddm
Copy link
Owner

iddm commented Apr 21, 2024

Thanks a lot! I sincerely apologise for the late response!

@andy128k andy128k deleted the owned-string branch April 21, 2024 12:35
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.

None yet

2 participants