Skip to content

Add Serialize trait to core data structures#370

Merged
L-M-Sherlock merged 3 commits intoopen-spaced-repetition:mainfrom
ishiko732:serialize
Oct 1, 2025
Merged

Add Serialize trait to core data structures#370
L-M-Sherlock merged 3 commits intoopen-spaced-repetition:mainfrom
ishiko732:serialize

Conversation

@ishiko732
Copy link
Member

This PR adds Serialize trait support to the core FSRS data structures, enabling serialization capabilities for key types
used throughout the library.

ref :

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ishiko732, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces serialization capabilities to the fundamental data structures within the FSRS library. By deriving the Serialize trait for key types, it paves the way for easier data persistence, exchange, and integration with other systems that rely on structured data formats.

Highlights

  • Serialization Support: The Serialize trait from the serde crate has been added to several core data structures, enabling them to be easily converted into various data formats.
  • Core Data Structures Updated: The MemoryState, NextStates, and ItemState structs in src/inference.rs now implement the Serialize trait.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds Serialize trait support to several core data structures (MemoryState, NextStates, ItemState), which is a valuable enhancement for the library. The changes are correct and well-implemented. I've suggested extending this serialization support to a few other public data structures in the same file for consistency. Overall, this is a good improvement.

}

#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Clone, Copy, Serialize)]
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This is a good addition. For consistency and to further enhance the library's serialization capabilities, consider also adding #[derive(Serialize)] to other public data structures in this file. Specifically, ModelEvaluation, ItemProgress, and TimeSeriesSplit seem like good candidates as they are also part of the public API and would benefit from being serializable.

Copy link
Member

@L-M-Sherlock L-M-Sherlock left a comment

Choose a reason for hiding this comment

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

LGTM

@L-M-Sherlock L-M-Sherlock merged commit 0187b45 into open-spaced-repetition:main Oct 1, 2025
4 checks passed
@ishiko732 ishiko732 deleted the serialize branch October 1, 2025 06:40
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