Closed demosdemon closed 1 month ago
Suppose you wanted to write a tower-esque trait using RPITIT:
pub trait LocalService<Request> { type Response; type Error; async fn execute(self, request: Request) -> Result<Self::Response, Self::Error>; }
This now works, but if I want to use make to add a Send variant, the macro fails:
make
Send
error: expected `:` --> src/example.rs:1:30 | 1 | #[trait_variant::make(Service<Request>: Send)] | ^
Omitting the generic parameters yields a different error:
error[E0412]: cannot find type `Request` in this scope --> src/example.rs:6:37 | 6 | async fn execute(self, request: Request) -> Result<Self::Response, Self::Error>; | ^^^^^^^ not found in this scope | help: consider importing one of these items | 1 + use core::error::Request; | 1 + use std::error::Request; | error[E0107]: missing generics for trait `LocalService` --> src/example.rs:2:11 | 2 | pub trait LocalService<Request> { | ^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `Request` --> src/example.rs:2:11 | 2 | pub trait LocalService<Request> { | ^^^^^^^^^^^^ ------- help: add missing generic argument | 2 | pub trait LocalService<Request><Request> { | +++++++++ error[E0107]: missing generics for trait `Service` --> src/example.rs:1:23 | 1 | #[trait_variant::make(Service: Send)] | ^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `Request` --> src/example.rs:1:23 | 1 | #[trait_variant::make(Service: Send)] | ^^^^^^^ 2 | pub trait LocalService<Request> { | ------- help: add missing generic argument | 1 | #[trait_variant::make(Service<Request>: Send)] | +++++++++
Should this be closed?
Suppose you wanted to write a tower-esque trait using RPITIT:
This now works, but if I want to use
make
to add aSend
variant, the macro fails:Omitting the generic parameters yields a different error: