Skip to content

Commit 8a6c5bf

Browse files
authored
Dp/smol change sig new (#135)
* chg: sig New return Signature * regen sigs and updated types * bump vers * bump tests version
1 parent 0830eda commit 8a6c5bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+222
-163
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "scale_rs"
3-
version = "0.4.5"
3+
version = "0.4.7"
44
edition = "2021"
55
description = "Scale is a framework for building high-performance plugin systems into any application, all powered by WebAssembly."
66
homepage = "https://scale.sh"

extension/generator/golang/generated.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature v0.4.5, DO NOT EDIT.
1+
// Code generated by scale-signature v0.4.7, DO NOT EDIT.
22
// output: types
33

44
package types

extension/generator/golang/guest.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-extension v0.4.5, DO NOT EDIT.
1+
// Code generated by scale-extension v0.4.7, DO NOT EDIT.
22
// output: extfetch
33

44
package extfetch

extension/generator/golang/host.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-extension v0.4.5, DO NOT EDIT.
1+
// Code generated by scale-extension v0.4.7, DO NOT EDIT.
22
// output: extfetch
33

44
package extfetch

extension/generator/golang/interfaces.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-extension v0.4.5, DO NOT EDIT.
1+
// Code generated by scale-extension v0.4.7, DO NOT EDIT.
22
// output: extfetch
33

44
package extfetch

extension/generator/rust/generated.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.7, DO NOT EDIT.
22
// output: types
33

44
#![allow(dead_code)]

extension/generator/rust/guest.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-extension 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-extension 0.4.7, DO NOT EDIT.
22
// output: guest
33

44
pub mod types;

extension/generator/typescript/generated.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.7, DO NOT EDIT.
22
// output: types
33

44
import { Encoder, Decoder, Kind } from "@loopholelabs/polyglot"

extension/generator/typescript/guest.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-extension 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-extension 0.4.7, DO NOT EDIT.
22
// output: v0.1.0
33

44
/* eslint no-bitwise: off */

extension/generator/typescript/host.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-extension 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-extension 0.4.7, DO NOT EDIT.
22
// output: v0.1.0
33

44
/* eslint no-bitwise: off */

integration/golang_ext_tests/extension/go.mod

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ module local_inttest_latest_guest
22

33
go 1.20
44

5-
require github.com/loopholelabs/polyglot v1.1.3
5+
require (
6+
github.com/loopholelabs/polyglot v1.1.3
7+
github.com/loopholelabs/scale-extension-interfaces v0.1.0
8+
)

integration/golang_ext_tests/extension/guest.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_ext_tests/extension/interfaces.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_ext_tests/extension/types.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_ext_tests/host_extension/host.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_ext_tests/host_extension/interfaces.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_ext_tests/host_extension/types.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/generated/generated.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/host_signature/host.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/host_signature/types.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/signature/go.mod

+3-9
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ module signature
33
go 1.20
44

55
require (
6-
github.com/loopholelabs/polyglot v1.1.3
7-
github.com/stretchr/testify v1.8.4
8-
)
9-
10-
require (
11-
github.com/davecgh/go-spew v1.1.1 // indirect
12-
github.com/pmezard/go-difflib v1.0.0 // indirect
13-
gopkg.in/yaml.v3 v3.0.1 // indirect
14-
)
6+
github.com/loopholelabs/polyglot v1.1.3
7+
github.com/loopholelabs/scale-signature-interfaces v0.1.7
8+
)

integration/golang_tests/signature/guest.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/golang_tests/signature/types.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/rust_ext_tests/extension/guest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-extension 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-extension 0.4.7, DO NOT EDIT.
22
// output: local_inttest_latest_guest
33

44
pub mod types;

integration/rust_ext_tests/extension/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Code generated by scale-signature 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.7, DO NOT EDIT.
22
// output: local_inttest_latest_guest
33

44
#![allow(dead_code)]

integration/rust_tests/generated/generated.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
// Code generated by scale-signature 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.7, DO NOT EDIT.
22
// output: generated
33

44
#![allow(dead_code)]
55
#![allow(unused_imports)]
66
#![allow(unused_variables)]
77
#![allow(unused_mut)]
8+
use std::io::Cursor;
9+
use polyglot_rs::{DecodingError, Encoder, Decoder, Kind};
810
use num_enum::TryFromPrimitive;
9-
use polyglot_rs::{Decoder, DecodingError, Encoder, Kind};
10-
use regex::Regex;
11-
use std::collections::HashMap;
1211
use std::convert::TryFrom;
13-
use std::io::Cursor;
12+
use std::collections::HashMap;
13+
use regex::Regex;
1414
pub trait Encode {
1515
fn encode<'a>(
1616
a: Option<&Self>,
@@ -26,7 +26,9 @@ trait EncodeSelf {
2626
) -> Result<&'a mut Cursor<Vec<u8>>, Box<dyn std::error::Error>>;
2727
}
2828
pub trait Decode {
29-
fn decode(b: &mut Cursor<&mut Vec<u8>>) -> Result<Option<Self>, Box<dyn std::error::Error>>
29+
fn decode(
30+
b: &mut Cursor<&mut Vec<u8>>,
31+
) -> Result<Option<Self>, Box<dyn std::error::Error>>
3032
where
3133
Self: Sized;
3234
}
@@ -87,7 +89,9 @@ impl EncodeSelf for Option<Context> {
8789
}
8890
}
8991
impl Decode for Context {
90-
fn decode(d: &mut Cursor<&mut Vec<u8>>) -> Result<Option<Context>, Box<dyn std::error::Error>> {
92+
fn decode(
93+
d: &mut Cursor<&mut Vec<u8>>,
94+
) -> Result<Option<Context>, Box<dyn std::error::Error>> {
9195
if d.decode_none() {
9296
return Ok(None);
9397
}

integration/rust_tests/signature/guest.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
// Code generated by scale-signature 0.4.5, DO NOT EDIT.
1+
// Code generated by scale-signature 0.4.7, DO NOT EDIT.
22
// output: local_example_latest_guest
33

44
pub mod types;
5-
use crate::types::{Decode, Encode};
6-
use polyglot_rs::Encoder;
5+
use crate::types::{Encode, Decode};
76
use std::io::Cursor;
7+
use polyglot_rs::Encoder;
88
static HASH: &'static str = "3a592aa345d412faa2e6285ee048ca2ab5aa64b0caa2f9ca67b2c1e0792101e5";
99
static mut READ_BUFFER: Vec<u8> = Vec::new();
1010
static mut WRITE_BUFFER: Vec<u8> = Vec::new();
1111
pub unsafe fn write(ctx: Option<&mut types::ModelWithAllFieldTypes>) -> (u32, u32) {
1212
let mut cursor = Cursor::new(Vec::new());
1313
match ctx {
1414
Some(ctx) => {
15-
cursor = match types::ModelWithAllFieldTypes::encode(Some(ctx), &mut cursor) {
15+
cursor = match types::ModelWithAllFieldTypes::encode(
16+
Some(ctx),
17+
&mut cursor,
18+
) {
1619
Ok(_) => cursor,
1720
Err(err) => return error(err),
1821
};
@@ -29,7 +32,10 @@ pub unsafe fn write(ctx: Option<&mut types::ModelWithAllFieldTypes>) -> (u32, u3
2932
WRITE_BUFFER.copy_from_slice(&vec);
3033
return (WRITE_BUFFER.as_ptr() as u32, WRITE_BUFFER.len() as u32);
3134
}
32-
pub unsafe fn read() -> Result<Option<types::ModelWithAllFieldTypes>, Box<dyn std::error::Error>> {
35+
pub unsafe fn read() -> Result<
36+
Option<types::ModelWithAllFieldTypes>,
37+
Box<dyn std::error::Error>,
38+
> {
3339
let mut cursor = Cursor::new(&mut READ_BUFFER);
3440
types::ModelWithAllFieldTypes::decode(&mut cursor)
3541
}

0 commit comments

Comments
 (0)