Skip to content

Conversation

@jexjws
Copy link
Contributor

@jexjws jexjws commented Oct 29, 2025

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 an async fn-like developer experience by desugaring it into the fn call(...) -> impl Future signature required by the Service trait.

Since the Rust compiler can now handle this conversion automatically, we should deprecate the macro and encourage users to implement async fn call directly.

Solution

This PR deprecates the macro and removes its documentation:

  1. motore-macros/src/lib.rs: Added #[deprecated] to the macro definition with a note explaining why it's no longer needed.
  2. motore/src/lib.rs: Added #[deprecated] to the re-exported service macro.
  3. motore/src/lib.rs: Added #[allow(deprecated)] to test_service_macro to prevent CI failures from our own deprecation warning.
  4. README.md: Removed the entire section and all examples related to the #[motore::service] macro. The existing "Getting Started" example for Timeout already serves as a perfect, macro-less example of how to implement the trait.

Related

  1. docs(volo/motore): add some content cloudwego.github.io#1451 (comment)

@jexjws
Copy link
Contributor Author

jexjws commented Oct 29, 2025

emm,有必要给这两个包的小版本号加一嘛

@PureWhiteWu
Copy link
Member

十分感谢你的贡献!
可以顺手给小版本号 +1。

- motore: 0.4.2 -> 0.4.3
- motore-macros: 0.4.3 -> 0.4.4
@jexjws
Copy link
Contributor Author

jexjws commented Oct 29, 2025

十分感谢你的贡献! 可以顺手给小版本号 +1。

OK,我记住了,以后会顺手加

@PureWhiteWu PureWhiteWu merged commit 4ffc999 into cloudwego:main Oct 29, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants