Open
Description
This macro fails when you have inner types as context bounds of your trait functions.
Consider you have this type:
#[trait_variant::make(Aggregate: Send)]
pub trait LocalAggregate: Default + Serialize + DeserializeOwned + Sync + Send + Stream {
type Command: Send + Sync;
type Error: std::error::Error + From<AggregateStoreError>;
type Services: Send + Sync;
fn handle(
&self,
command: &Self::Command,
services: &Self::Services,
) -> impl Future<Output = Result<Vec<Self::Event>, Self::Error>>;
}
And you want to implement a trait where you can handle this aggregate commands like this:
#[trait_variant::make(AggregateStore: Send)]
pub trait LocalAggregateStore {
fn apply_command_and_store_events<A: Aggregate,>(
&self,
stream_id: &Urn,
stream_type: String,
metadata: crate::Metadata,
command: A::Command,
expected_version: Option<i64>,
) -> impl Future<Output = Result<(), A::Error>>
}
This fails to compile with next error:
--> es/src/persistence/store.rs:32:9
|
32 | command: A::Command,
| ^^^^^^^ cannot infer type
|
= note: cannot satisfy `<_ as Aggregate>::Command == _`
Metadata
Metadata
Assignees
Labels
No labels