diff --git a/packages/schema/bind/src/bindings/rust/wasm/templates/imported/module-type/mod-rs.mustache b/packages/schema/bind/src/bindings/rust/wasm/templates/imported/module-type/mod-rs.mustache index c8cc0c8389..68a3c9bb93 100644 --- a/packages/schema/bind/src/bindings/rust/wasm/templates/imported/module-type/mod-rs.mustache +++ b/packages/schema/bind/src/bindings/rust/wasm/templates/imported/module-type/mod-rs.mustache @@ -55,23 +55,23 @@ impl {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { {{/isInterface}} {{#isInterface}} #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}<'a> { - {{#isInterface}}uri: &'a str{{/isInterface}} +pub struct {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#isInterface}}uri: String{{/isInterface}} } -impl<'a> {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}<'a> { +impl {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { pub const INTERFACE_URI: &'static str = "{{uri}}"; - pub fn new(uri: &'a str) -> {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}<'a> { - {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { uri: uri } + pub fn new(uri: String) -> {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { + {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} { uri } } {{#methods}} pub fn {{#toLower}}{{name}}{{/toLower}}(&self, args: &Args{{#toUpper}}{{name}}{{/toUpper}}) -> Result<{{#return}}{{#toWasm}}{{toGraphQLType}}{{/toWasm}}{{/return}}, String> { - let uri = self.uri; + let ref uri = self.uri; let args = serialize_{{#toLower}}{{name}}{{/toLower}}_args(args).map_err(|e| e.to_string())?; let result = subinvoke::wrap_subinvoke( - uri, + uri.as_str(), "{{name}}", args, )?; diff --git a/packages/test-cases/cases/bind/sanity/output/wasm-rs/imported/test_import_module/mod.rs b/packages/test-cases/cases/bind/sanity/output/wasm-rs/imported/test_import_module/mod.rs index 8d14dd988c..d265f90a57 100644 --- a/packages/test-cases/cases/bind/sanity/output/wasm-rs/imported/test_import_module/mod.rs +++ b/packages/test-cases/cases/bind/sanity/output/wasm-rs/imported/test_import_module/mod.rs @@ -26,22 +26,22 @@ use crate::TestImportEnum; use crate::TestImportEnumReturn; #[derive(Clone, Debug, Deserialize, Serialize)] -pub struct TestImportModule<'a> { - uri: &'a str +pub struct TestImportModule { + uri: String } -impl<'a> TestImportModule<'a> { +impl TestImportModule { pub const INTERFACE_URI: &'static str = "testimport.uri.eth"; - pub fn new(uri: &'a str) -> TestImportModule<'a> { - TestImportModule { uri: uri } + pub fn new(uri: String) -> TestImportModule { + TestImportModule { uri } } pub fn imported_method(&self, args: &ArgsImportedMethod) -> Result, String> { - let uri = self.uri; + let ref uri = self.uri; let args = serialize_imported_method_args(args).map_err(|e| e.to_string())?; let result = subinvoke::wrap_subinvoke( - uri, + uri.as_str(), "importedMethod", args, )?; @@ -49,10 +49,10 @@ impl<'a> TestImportModule<'a> { } pub fn another_method(&self, args: &ArgsAnotherMethod) -> Result { - let uri = self.uri; + let ref uri = self.uri; let args = serialize_another_method_args(args).map_err(|e| e.to_string())?; let result = subinvoke::wrap_subinvoke( - uri, + uri.as_str(), "anotherMethod", args, )?; @@ -60,10 +60,10 @@ impl<'a> TestImportModule<'a> { } pub fn returns_array_of_enums(&self, args: &ArgsReturnsArrayOfEnums) -> Result>, String> { - let uri = self.uri; + let ref uri = self.uri; let args = serialize_returns_array_of_enums_args(args).map_err(|e| e.to_string())?; let result = subinvoke::wrap_subinvoke( - uri, + uri.as_str(), "returnsArrayOfEnums", args, )?; diff --git a/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-use-getImpl/src/lib.rs b/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-use-getImpl/src/lib.rs index beadad39df..3fda9b668e 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-use-getImpl/src/lib.rs +++ b/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-use-getImpl/src/lib.rs @@ -13,8 +13,7 @@ pub fn module_method(args: ArgsModuleMethod) -> ImplementationType { pub fn abstract_module_method(args: ArgsAbstractModuleMethod) -> String { let impls = Interface::get_implementations(); - let uri: String = impls[0].to_owned(); - let module = InterfaceModule::new(&uri); + let module = InterfaceModule::new(impls[0].clone()); let method_args = interface_module::serialization::ArgsAbstractModuleMethod { arg: interface_argument::InterfaceArgument { str: args.arg.str