Skip to content

Commit be21f45

Browse files
authored
Merge pull request #1728 from polywrap/chore/update-rust-plugin-bindings
chore: update rust plugin bindings
2 parents 50b5722 + 4f4cd77 commit be21f45

6 files changed

Lines changed: 17 additions & 27 deletions

File tree

packages/schema/bind/src/bindings/rust/plugin/templates/module-rs.mustache

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
/// All modifications will be overwritten.
33

44
use std::sync::Arc;
5-
use polywrap_core::{invoke::Invoker};
6-
use polywrap_plugin::error::PluginError;
7-
use polywrap_plugin::module::PluginModule;
5+
use polywrap_core::invoke::Invoker;
6+
use polywrap_plugin::{error::PluginError, module::PluginModule};
87
use serde::{Serialize, Deserialize};
98
use super::types::*;
109

packages/schema/bind/src/bindings/rust/plugin/templates/types-rs.mustache

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@
33

44
// NOTE: This is an auto-generated file.
55
// All modifications will be overwritten.
6+
use polywrap_core::{invoke::Invoker, uri::Uri};
7+
use polywrap_msgpack::{decode, serialize};
8+
use polywrap_plugin::{error::PluginError, BigInt, BigNumber, Map, JSON};
69
use serde::{Serialize, Deserialize};
7-
use num_bigint::BigInt;
8-
use bigdecimal::BigDecimal as BigNumber;
9-
use serde_json as JSON;
10-
use polywrap_msgpack::extensions::generic_map::GenericMap as Map;
1110
{{#importedModuleTypes}}
1211
use std::sync::Arc;
13-
use polywrap_msgpack::{decode, serialize};
14-
use polywrap_core::{invoke::{Invoker}, uri::Uri};
15-
use polywrap_plugin::error::PluginError;
1612
{{/importedModuleTypes}}
1713

1814
// Env START //
@@ -129,7 +125,7 @@ impl {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}} {
129125
.map_err(|e| PluginError::SubinvocationError {
130126
uri: uri.to_string(),
131127
method: "{{name}}".to_string(),
132-
args: serde_json::to_string(&args).unwrap(),
128+
args: JSON::to_string(&args).unwrap(),
133129
exception: e.to_string(),
134130
})?;
135131
@@ -168,7 +164,7 @@ impl<'a> {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}<'a
168164
.map_err(|e| PluginError::SubinvocationError {
169165
uri: uri.to_string(),
170166
method: "{{name}}".to_string(),
171-
args: serde_json::to_string(&args).unwrap(),
167+
args: JSON::to_string(&args).unwrap(),
172168
exception: e.to_string(),
173169
})?;
174170

packages/schema/bind/src/bindings/rust/plugin/templates/wrap.info-rs.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// NOTE: This is an auto-generated file.
22
/// All modifications will be overwritten.
3+
use polywrap_plugin::JSON::{from_value, json};
34
use wrap_manifest_schemas::versions::{WrapManifest, WrapManifestAbi};
4-
use serde_json::{json, from_value};
55

66
{{#manifest}}
77
pub fn get_manifest() -> WrapManifest {

packages/test-cases/cases/bind/sanity/output/plugin-rs/module.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
/// All modifications will be overwritten.
33
44
use std::sync::Arc;
5-
use polywrap_core::{invoke::Invoker};
6-
use polywrap_plugin::error::PluginError;
7-
use polywrap_plugin::module::PluginModule;
5+
use polywrap_core::invoke::Invoker;
6+
use polywrap_plugin::{error::PluginError, module::PluginModule};
87
use serde::{Serialize, Deserialize};
98
use super::types::*;
109

packages/test-cases/cases/bind/sanity/output/plugin-rs/types.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33

44
// NOTE: This is an auto-generated file.
55
// All modifications will be overwritten.
6+
use polywrap_core::{invoke::Invoker, uri::Uri};
7+
use polywrap_msgpack::{decode, serialize};
8+
use polywrap_plugin::{error::PluginError, BigInt, BigNumber, Map, JSON};
69
use serde::{Serialize, Deserialize};
7-
use num_bigint::BigInt;
8-
use bigdecimal::BigDecimal as BigNumber;
9-
use serde_json as JSON;
10-
use polywrap_msgpack::extensions::generic_map::GenericMap as Map;
1110
use std::sync::Arc;
12-
use polywrap_msgpack::{decode, serialize};
13-
use polywrap_core::{invoke::{Invoker}, uri::Uri};
14-
use polywrap_plugin::error::PluginError;
1511

1612
// Env START //
1713

@@ -241,7 +237,7 @@ impl<'a> TestImportModule<'a> {
241237
.map_err(|e| PluginError::SubinvocationError {
242238
uri: uri.to_string(),
243239
method: "importedMethod".to_string(),
244-
args: serde_json::to_string(&args).unwrap(),
240+
args: JSON::to_string(&args).unwrap(),
245241
exception: e.to_string(),
246242
})?;
247243

@@ -261,7 +257,7 @@ impl<'a> TestImportModule<'a> {
261257
.map_err(|e| PluginError::SubinvocationError {
262258
uri: uri.to_string(),
263259
method: "anotherMethod".to_string(),
264-
args: serde_json::to_string(&args).unwrap(),
260+
args: JSON::to_string(&args).unwrap(),
265261
exception: e.to_string(),
266262
})?;
267263

@@ -281,7 +277,7 @@ impl<'a> TestImportModule<'a> {
281277
.map_err(|e| PluginError::SubinvocationError {
282278
uri: uri.to_string(),
283279
method: "returnsArrayOfEnums".to_string(),
284-
args: serde_json::to_string(&args).unwrap(),
280+
args: JSON::to_string(&args).unwrap(),
285281
exception: e.to_string(),
286282
})?;
287283

packages/test-cases/cases/bind/sanity/output/plugin-rs/wrap.info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// NOTE: This is an auto-generated file.
22
/// All modifications will be overwritten.
3+
use polywrap_plugin::JSON::{from_value, json};
34
use wrap_manifest_schemas::versions::{WrapManifest, WrapManifestAbi};
4-
use serde_json::{json, from_value};
55

66
pub fn get_manifest() -> WrapManifest {
77
WrapManifest {

0 commit comments

Comments
 (0)