From fc19f881e3e6a2c8c1cece5685bd0ea53c06b0f0 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com> Date: Mon, 16 May 2022 15:28:34 +0300 Subject: [PATCH] Implement `Clone` for the generated `RuntimeApi` (#544) * Implement Clone for the generated `RuntimeApi` Signed-off-by: Alexandru Vasile * Don't reexport Derivative Signed-off-by: Alexandru Vasile * Implement `Clone` manually Signed-off-by: Alexandru Vasile * Update `polkadot.rs` Signed-off-by: Alexandru Vasile --- codegen/src/api/mod.rs | 6 ++++++ integration-tests/src/codegen/polkadot.rs | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/codegen/src/api/mod.rs b/codegen/src/api/mod.rs index f770f4a233..01b3a2df6c 100644 --- a/codegen/src/api/mod.rs +++ b/codegen/src/api/mod.rs @@ -296,6 +296,12 @@ impl RuntimeGenerator { marker: ::core::marker::PhantomData, } + impl Clone for RuntimeApi { + fn clone(&self) -> Self { + Self { client: self.client.clone(), marker: ::core::marker::PhantomData } + } + } + impl ::core::convert::From<::subxt::Client> for RuntimeApi where T: ::subxt::Config, diff --git a/integration-tests/src/codegen/polkadot.rs b/integration-tests/src/codegen/polkadot.rs index 3ca134c6e9..d4dacbc6dc 100644 --- a/integration-tests/src/codegen/polkadot.rs +++ b/integration-tests/src/codegen/polkadot.rs @@ -50126,6 +50126,14 @@ pub mod api { pub client: ::subxt::Client, marker: ::core::marker::PhantomData, } + impl Clone for RuntimeApi { + fn clone(&self) -> Self { + Self { + client: self.client.clone(), + marker: ::core::marker::PhantomData, + } + } + } impl ::core::convert::From<::subxt::Client> for RuntimeApi where T: ::subxt::Config,