Skip to content

Commit

Permalink
Allow service which does extending only
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisInSky committed May 23, 2024
1 parent 90fee68 commit 8ae4c83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions macros/core/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,16 @@ fn gen_gservice_impl(args: TokenStream, service_impl: ItemImpl) -> TokenStream {
)
};

let service_base_types = service_args.items.iter().flat_map(|item| match item {
ServiceArg::Extends(paths) => paths,
});

let service_handlers = discover_service_handlers(&service_impl);

if service_handlers.is_empty() {
if service_handlers.is_empty() && !service_base_types.clone().any(|_| true) {
abort!(
service_impl,
"`gservice` attribute requires impl to define at least one public method"
"`gservice` attribute requires impl to define at least one public method or extend another service"
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: `gservice` attribute requires impl to define at least one public method
error: `gservice` attribute requires impl to define at least one public method or extend another service
--> tests/ui/gservice_fails_no_handlers_found.rs:6:1
|
6 | impl MyService {}
Expand Down

0 comments on commit 8ae4c83

Please sign in to comment.