Skip to content

Commit

Permalink
feat(query): Ensure concrete names for transformations are used when …
Browse files Browse the repository at this point in the history
…debugging
  • Loading branch information
timonv committed Dec 21, 2024
1 parent a4490f3 commit 1d9a255
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions swiftide-core/src/query_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ impl TransformQuery for Box<dyn TransformQuery> {
) -> Result<Query<states::Pending>> {
self.as_ref().transform_query(query).await
}

fn name(&self) -> &'static str {
self.as_ref().name()
}
}

/// A search strategy for the query pipeline
Expand Down Expand Up @@ -100,6 +104,10 @@ impl<S: SearchStrategy> Retrieve<S> for Box<dyn Retrieve<S>> {
) -> Result<Query<states::Retrieved>> {
self.as_ref().retrieve(search_strategy, query).await
}

fn name(&self) -> &'static str {
self.as_ref().name()
}
}

#[async_trait]
Expand Down Expand Up @@ -162,6 +170,10 @@ impl TransformResponse for Box<dyn TransformResponse> {
async fn transform_response(&self, query: Query<Retrieved>) -> Result<Query<Retrieved>> {
self.as_ref().transform_response(query).await
}

fn name(&self) -> &'static str {
self.as_ref().name()
}
}

/// Can answer the original query
Expand Down Expand Up @@ -207,6 +219,10 @@ impl Answer for Box<dyn Answer> {
async fn answer(&self, query: Query<Retrieved>) -> Result<Query<states::Answered>> {
self.as_ref().answer(query).await
}

fn name(&self) -> &'static str {
self.as_ref().name()
}
}

/// Evaluates a query
Expand Down

0 comments on commit 1d9a255

Please sign in to comment.