Skip to content

Commit

Permalink
self is immutable in the Plugin trait's methods (#3555)
Browse files Browse the repository at this point in the history
Fix #3539
  • Loading branch information
Geal authored Aug 10, 2023
1 parent 5203419 commit 747a352
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .changesets/docs_geal_plugin_doc_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### self is immutable in the Plugin trait's methods ([Issue #3539](https://github.com/apollographql/router/issues/3539))


By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/3555
10 changes: 5 additions & 5 deletions docs/source/customizations/native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ impl Plugin for HelloWorld {
// Only define the hooks you need to modify. Each default hook
// implementation returns its associated service with no changes.
fn router_service(
&mut self,
&self,
service: router::BoxService,
) -> router::BoxService {
service
}

fn supergraph_service(
&mut self,
&self,
service: router::BoxService,
) -> router::BoxService {
service
}

fn execution_service(
&mut self,
&self,
service: execution::BoxService,
) -> execution::BoxService {
service
Expand All @@ -120,7 +120,7 @@ impl Plugin for HelloWorld {
// being invoked. That's because this service might invoke *multiple*
// subgraphs for a single request, and this is called once for each.
fn subgraph_service(
&mut self,
&self,
name: &str,
service: subgraph::BoxService,
) -> subgraph::BoxService {
Expand All @@ -141,7 +141,7 @@ use tower::ServiceBuilderExt;
use apollo_router::ServiceBuilderExt as ApolloServiceBuilderExt;

fn supergraph_service(
&mut self,
&self,
service: router::BoxService,
) -> router::BoxService {
// Always use service builder to compose your plugins.
Expand Down

0 comments on commit 747a352

Please sign in to comment.