-
Notifications
You must be signed in to change notification settings - Fork 0
Deprecate SharedState::new #41
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
Conversation
Reviewer's GuideDeprecate SharedState::new in favor of using the From<Arc> conversion via into(), update all examples and docs to reflect the new construction pattern, and record the change in the CHANGELOG. Sequence Diagram: SharedState Creation via .into()sequenceDiagram
actor Developer
participant MyArcT as "my_arc: Arc<T>"
participant SharedStateType as "SharedState<T> (type)"
Developer->>MyArcT: .into()
activate MyArcT
MyArcT->>SharedStateType: ::from(my_arc)
deactivate MyArcT
activate SharedStateType
SharedStateType-->>Developer: new_shared_state_instance
deactivate SharedStateType
Updated Class Diagram for SharedStateclassDiagram
class SharedState~T~ {
<<Struct>>
#inner: Arc~T~
+new(inner: Arc~T~) SharedState~T~ "<<deprecated since 0.2.0, construct via inner.into() instead>>"
+from(inner: Arc~T~) SharedState~T~
+deref() &T
}
class Arc~T~ {
<<Struct>>
+into() SharedState~T~
}
Arc~T~ ..> SharedState~T~ : .into() calls SharedState.from()
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Warning Rate limit exceeded@leynos has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 39 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gates Passed
6 Quality Gates Passed
See analysis details in CodeScene
Absence of Expected Change Pattern
- wireframe/src/extractor.rs is usually changed with: wireframe/src/server.rs, wireframe/src/middleware.rs
Quality Gate Profile: Pay Down Tech Debt
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @leynos - I've reviewed your changes - here's some feedback:
- Add a
since
field to the#[deprecated]
attribute to provide clearer deprecation metadata. - Double-check there are no remaining references to
SharedState::new
in tests or examples to ensure full migration toinner.into()
.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add a `since` field to the `#[deprecated]` attribute to provide clearer deprecation metadata.
- Double-check there are no remaining references to `SharedState::new` in tests or examples to ensure full migration to `inner.into()`.
## Individual Comments
### Comment 1
<location> `src/extractor.rs:84` </location>
<code_context>
+ /// let shared: SharedState<u32> = state.clone().into();
/// assert_eq!(*shared, 42);
/// ```
+ #[deprecated(note = "construct via `inner.into()` instead")]
pub fn new(inner: Arc<T>) -> Self {
Self(inner)
</code_context>
<issue_to_address>
Include `since` in `#[deprecated]` attribute
Adding a `since` version clarifies when the deprecation was introduced.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
#[deprecated(note = "construct via `inner.into()` instead")]
=======
#[deprecated(since = "0.3.0", note = "construct via `inner.into()` instead")]
>>>>>>> REPLACE
</suggested_fix>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gates Passed
6 Quality Gates Passed
See analysis details in CodeScene
Absence of Expected Change Pattern
- wireframe/src/extractor.rs is usually changed with: wireframe/src/server.rs, wireframe/src/middleware.rs
Quality Gate Profile: Pay Down Tech Debt
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @leynos - I've reviewed your changes - here's some feedback:
- The markdownlint run is failing with hundreds of errors—please fix or suppress these so the docs build cleanly in CI.
- Double-check for any leftover
SharedState::new
usages (in examples, tests, etc.) and update them to the.into()
constructor to keep things consistent.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The markdownlint run is failing with hundreds of errors—please fix or suppress these so the docs build cleanly in CI.
- Double-check for any leftover `SharedState::new` usages (in examples, tests, etc.) and update them to the `.into()` constructor to keep things consistent.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gates Passed
6 Quality Gates Passed
See analysis details in CodeScene
Absence of Expected Change Pattern
- wireframe/src/extractor.rs is usually changed with: wireframe/src/server.rs, wireframe/src/middleware.rs
Quality Gate Profile: Pay Down Tech Debt
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
Summary
SharedState::new
as deprecatedSharedState
viaFrom
implsCHANGELOG
Testing
cargo clippy -- -D warnings
RUSTFLAGS="-D warnings" cargo test
markdownlint README.md docs/*.md CHANGELOG.md
(fails: 297 errors)nixie README.md docs/*.md
https://chatgpt.com/codex/tasks/task_e_684e35de1fbc8322a8b8df5c164be392
Summary by Sourcery
Deprecate the SharedState::new constructor in favor of the From impl and update documentation and code examples accordingly
Enhancements:
Documentation: