refactor!: replace lazy_static with std::sync::OnceLock#127
Conversation
This change enables Webassembly compatibility by replacing `lazy_static` with `syd::sync:OnceLock` and tokio feature changes. It should be considered breaking due MSRV change. This change doesn't have any performance impact on the library itself. tokio's `sync` feature provides `RwLock` which works identically regardless of runtime. Users of this library can enable tokio's multi-threaded runtime if needed. Changes in summary: - Replace lazy_static crate with std::sync::OnceLock for singleton - Bump MSRV from 1.77.0 to 1.80.1 - Remove lazy_static dependency - Split tokio features: sync for library, rt-multi-thread/macros for tests - Update doc comment to reference public API methods Signed-off-by: Eren Atas <eren.atas@booking.com>
Summary of ChangesHello @erenatas, 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 modernizes the library's singleton initialization mechanism by migrating from the Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly replaces lazy_static with std::sync::OnceLock to improve WebAssembly compatibility and modernize the codebase. The changes also include a sensible split of tokio features between library dependencies and development dependencies, which is a great improvement. The implementation of the singleton pattern using OnceLock is correct and thread-safe. I have one suggestion to improve the naming of a helper function for better clarity.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Eren Atas <sovairon@gmail.com>
Signed-off-by: Eren Atas <eren.atas@booking.com>
jonathannorris
left a comment
There was a problem hiding this comment.
Looks good to me, scoping tokio should help with WASM support.
This PR
This change enables Webassembly compatibility by replacing
lazy_staticwithsyd::sync:OnceLockand tokio feature changes. It should be considered breaking due MSRV change.This change doesn't have any performance impact on the library itself. tokio's
syncfeature providesRwLockwhich works identically regardless of runtime. Users of this library can enable tokio's multi-threaded runtime if needed.Changes in summary:
Related Issues
This change is the first follow up from comments over Slack regarding web assembly compatibility requests