refactor: Deprecate #[motore::service] macro #54
Merged
+11
−26
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.
Motivation
Now that
async fn in trait(AFIT) is stable in Rust, the#[motore::service]macro is no longer necessary. This macro was originally created as a workaround to provide anasync fn-like developer experience by desugaring it into thefn call(...) -> impl Futuresignature required by theServicetrait.Since the Rust compiler can now handle this conversion automatically, we should deprecate the macro and encourage users to implement
async fn calldirectly.Solution
This PR deprecates the macro and removes its documentation:
motore-macros/src/lib.rs: Added#[deprecated]to the macro definition with a note explaining why it's no longer needed.motore/src/lib.rs: Added#[deprecated]to the re-exportedservicemacro.motore/src/lib.rs: Added#[allow(deprecated)]totest_service_macroto prevent CI failures from our own deprecation warning.README.md: Removed the entire section and all examples related to the#[motore::service]macro. The existing "Getting Started" example forTimeoutalready serves as a perfect, macro-less example of how to implement the trait.Related