change Service::run to take self: Box<Self>#5
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Service trait so run consumes the service as self: Box<Self>, aligning the runtime to own each service for the duration of its execution (and enabling object-safe consumption via Box<dyn Service>).
Changes:
- Changed
Service::runsignature from&mut selftoself: Box<Self>and updated the runtime call path accordingly. - Updated all tests and the README example to match the new
Service::runsignature. - Bumped crate version to
0.3.0to reflect the API-breaking change.
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| trzcina/src/service.rs | Changes the Service trait to consume Box<Self> in run. |
| trzcina/src/running_service_collection.rs | Adjusts service execution/classification to pass ownership into run. |
| trzcina/tests/supports_notify_driven_event_loop_pattern.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/supports_mutable_internal_state_across_iterations.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/supports_multi_channel_select_pump_pattern.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/supports_interval_ticker_reconciliation_pattern.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/supports_internal_retry_loop_pattern.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/supports_actix_style_shutdown_signal_pattern.rs | Refactors sender ownership and updates run signature. |
| trzcina/tests/run_reports_leaked_beyond_shutdown_deadline_when_service_ignores_abort.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/run_records_string_panic_payload.rs | Updates panicking service run signature to Box<Self>. |
| trzcina/tests/run_records_string_literal_panic_payload.rs | Updates panicking service run signature to Box<Self>. |
| trzcina/tests/run_records_service_panic_and_cancels_siblings.rs | Splits configured service into dedicated services; updates run signature. |
| trzcina/tests/run_records_service_error_and_cancels_siblings.rs | Splits configured service into dedicated services; updates run signature. |
| trzcina/tests/run_records_non_string_panic_payload.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/run_records_all_failures_when_multiple_services_error.rs | Splits configured service into dedicated services; updates run signature. |
| trzcina/tests/run_completes_when_all_services_finish_simultaneously.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/run_cancels_siblings_when_one_service_finishes_first.rs | Splits configured service into dedicated services; updates run signature. |
| trzcina/tests/run_cancels_all_services_when_external_token_cancelled.rs | Refactors sender ownership and updates run signature. |
| trzcina/tests/run_applies_cooperative_and_abort_deadlines_independently.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/run_aborts_hung_services_on_external_cancel.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/run_aborts_hung_service_after_shutdown_deadline.rs | Updates test service run signature to Box<Self>. |
| trzcina/tests/register_service_runs_registered_service.rs | Refactors sender ownership and updates run signature. |
| trzcina/tests/register_bundle_runs_all_services_returned_by_bundle.rs | Splits bundle/service types; refactors sender ownership and run signature. |
| trzcina/tests/coordinates_via_shared_holder_between_two_services.rs | Splits producer/consumer; refactors sender ownership and run signature. |
| trzcina/Cargo.toml | Bumps crate version to 0.3.0. |
| README.md | Updates example Service::run signature to self: Box<Self>. |
| Cargo.lock | Updates locked crate version to 0.3.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.