mirror of
https://github.com/extism/extism.git
synced 2026-01-10 06:18:00 -05:00
main
12 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7133dfc4e0 |
chore(deps): Update prost requirement from 0.13.1 to 0.14.1 (#865)
Updates the requirements on [prost](https://github.com/tokio-rs/prost) to permit the latest version. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/tokio-rs/prost/blob/master/CHANGELOG.md">prost's changelog</a>.</em></p> <blockquote> <h1>Prost version 0.14.1</h1> <p><em>PROST!</em> is a <a href="https://developers.google.com/protocol-buffers/">Protocol Buffers</a> implementation for the <a href="https://www.rust-lang.org/">Rust Language</a>. <code>prost</code> generates simple, idiomatic Rust code from <code>proto2</code> and <code>proto3</code> files.</p> <h2>⚠️ Revert emission of <code>rerun</code> commands</h2> <p>Version 0.14.1 reverts the emission of <code>rerun</code> commands. Other than this change, it is identical to 0.14.0.</p> <p>In version 0.14.0, <code>prost-build</code> began emitting <code>rerun</code> commands. While intended to improve build correctness, this change caused regressions for some users—for example, those generating <code>protos</code> from an <code>includes</code> directory. These edge cases are difficult to address reliably, so the change has been rolled back in 0.14.1.</p> <p>For more details, see [issue <a href="https://redirect.github.com/tokio-rs/prost/issues/1296">#1296</a>](<a href="https://redirect.github.com/tokio-rs/prost/issues/1296">tokio-rs/prost#1296</a>).</p> <h2>Breaking changes</h2> <ul> <li> <p>prost: Relax Message Debug trait bound (<a href="https://redirect.github.com/tokio-rs/prost/issues/1147">#1147</a>)</p> <p>BREAKING CHANGE: <code>trait Debug</code> was a supertrait of <code>trait Message</code>. This is no longer required by <code>prost</code>. If your code relies on <code>trait Debug</code> being implemented for every <code>impl Message</code>, you must now explicitly state that you require both Debug and Message. For example: <code>where M: Debug + Message</code></p> </li> <li> <p>prost: Remove prost-derive feature (<a href="https://redirect.github.com/tokio-rs/prost/issues/1247">#1247</a>)</p> <p>BREAKING CHANGE: Feature flag <code>prost-derive</code> is renamed to <code>derive</code>. Please rename any usage of <code>prost-derive</code> feature in your <code>Cargo.toml</code>.</p> </li> <li> <p>prost-build: Prevent repeated fields to be boxed (<a href="https://redirect.github.com/tokio-rs/prost/issues/1237">#1237</a>)</p> <p>BREAKING CHANGE: A repeated field that is manually marked as boxed was typed as <code>Vec<Box<T>></code>. Those fields are now simply typed as <code>Vec<T></code> to prevent double indirection. The <code>boxed</code> configuration is effectively ignored for repeated fields.</p> </li> <li> <p>prost-build: Make <code>type_name_domain</code> cumulative (<a href="https://redirect.github.com/tokio-rs/prost/issues/1228">#1228</a>)</p> <p>BREAKING CHANGE: The configuration for domain names of messages is now cumulative. All calls to <code>prost_build::Config::type_name_domain</code> are now concatenated. The previous behavior was that only the arguments of the last call were used. If you do multiple calls to type_name_domain, you need to remove all but the last call to maintain the same behavior.</p> </li> <li> <p>prost-build: Derive Eq and Hash trait for messages where possible (<a href="https://redirect.github.com/tokio-rs/prost/issues/1175">#1175</a>)</p> <p>BREAKING CHANGE: <code>prost-build</code> will automatically derive <code>trait Eq</code> and <code>trait Hash</code> for types where all field support those as well. If you manually <code>impl Eq</code> and/or <code>impl Hash</code> for generated types, then you need to remove the manual implementation. If you use <code>type_attribute</code> to <code>derive(Eq)</code> and/or <code>derive(Hash)</code>, then you need to remove those.</p> </li> </ul> <h2>Features</h2> <ul> <li>prost-types: Implement conversion <code>Duration</code> to/from <code>chrono::TimeDelta</code> (<a href="https://redirect.github.com/tokio-rs/prost/issues/1236">#1236</a>)</li> <li>prost-build: Prepare for 2024 keyword <code>gen</code> (<a href="https://redirect.github.com/tokio-rs/prost/issues/1257">#1257</a>)</li> </ul> <h2>Dependencies</h2> <ul> <li><em>(deps)</em> Update pulldown-cmark to 0.13 (<a href="https://redirect.github.com/tokio-rs/prost/issues/1259">#1259</a>)</li> <li><em>(deps)</em> update criterion requirement from 0.5 to 0.6 (<a href="https://redirect.github.com/tokio-rs/prost/issues/1280">#1280</a>)</li> </ul> <h2>Documentation</h2> <ul> <li>Update dead link LICENSE in <code>prost-types/README.md</code> (<a href="https://redirect.github.com/tokio-rs/prost/issues/1262">#1262</a>)</li> </ul> <h2>Styling</h2> <ul> <li>Use DoubleEndedIterator::next_back (<a href="https://redirect.github.com/tokio-rs/prost/issues/1255">#1255</a>)</li> <li>Fix typo (<a href="https://redirect.github.com/tokio-rs/prost/issues/1260">#1260</a>)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
|
|
9da8088ebf |
chore(deps): Update prost requirement from 0.12.0 to 0.13.1 (#741)
Updates the requirements on [prost](https://github.com/tokio-rs/prost) to permit the latest version. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/tokio-rs/prost/blob/master/CHANGELOG.md">prost's changelog</a>.</em></p> <blockquote> <h1>Prost version 0.13.1</h1> <p><em>PROST!</em> is a <a href="https://developers.google.com/protocol-buffers/">Protocol Buffers</a> implementation for the <a href="https://www.rust-lang.org/">Rust Language</a>. <code>prost</code> generates simple, idiomatic Rust code from <code>proto2</code> and <code>proto3</code> files.</p> <h2>Bug fixes</h2> <ul> <li>Enum variant named Error causes ambiguous item (<a href="https://redirect.github.com/tokio-rs/prost/issues/1098">#1098</a>)</li> </ul> <h1>PROST version 0.13.0</h1> <p><strong>note</strong>: this version was yanked in favor of 0.13.1</p> <p><em>PROST!</em> is a <a href="https://developers.google.com/protocol-buffers/">Protocol Buffers</a> implementation for the <a href="https://www.rust-lang.org/">Rust Language</a>. <code>prost</code> generates simple, idiomatic Rust code from <code>proto2</code> and <code>proto3</code> files.</p> <p>This major update brings new features and fixes:</p> <h2>Breaking changes</h2> <ul> <li> <p>derive Copy trait for messages where possible (<a href="https://redirect.github.com/tokio-rs/prost/issues/950">#950</a>)</p> <p><code>prost-build</code> will automatically derive <code>trait Copy</code> for some messages. If you manually implement <code>Copy</code> you should remove your implementation.</p> </li> <li> <p>Change generated functions signatures to remove type parameters (<a href="https://redirect.github.com/tokio-rs/prost/issues/1045">#1045</a>)</p> <p>The function signature of <code>trait Message</code> is changed to use <code>impl Buf</code> instead of a named generic type. If you implement <code>trait Message</code>, you should change the function signature.</p> </li> <li> <p>Lightweight error value in TryFrom<!-- raw HTML omitted --> for enums (<a href="https://redirect.github.com/tokio-rs/prost/issues/1010">#1010</a>)</p> <p>When a <code>impl TryFrom<i32></code> is generated by <code>prost</code> derive macros, it will now return the error type <code>UnknownEnumValue</code> instead of <code>DecodeError</code>. The new error can be used to retreive the integer value that failed to convert.</p> </li> </ul> <h2>Features</h2> <ul> <li> <p>fix: Only touch include file if contents is changed (<a href="https://redirect.github.com/tokio-rs/prost/issues/1058">#1058</a>)</p> <p>Most generated files are untouched when the contents doesn't change. Use the same mechanism for include file as well.</p> </li> </ul> <h2>Dependencies</h2> <ul> <li>update env_logger requirement from 0.10 to 0.11 (<a href="https://redirect.github.com/tokio-rs/prost/issues/1074">#1074</a>)</li> <li>update criterion requirement from 0.4 to 0.5 (<a href="https://redirect.github.com/tokio-rs/prost/issues/1071">#1071</a>)</li> <li>Remove unused libz-sys (<a href="https://redirect.github.com/tokio-rs/prost/issues/1077">#1077</a>)</li> <li>build(deps): update itertools requirement from >=0.10, <!-- raw HTML omitted -->=0.10, <=0.13 (<a href="https://redirect.github.com/tokio-rs/prost/issues/1070">#1070</a>)</li> </ul> <h2>Documentation</h2> <ul> <li>better checking of tag duplicates, avoid discarding invalid variant errs (<a href="https://redirect.github.com/tokio-rs/prost/issues/951">#951</a>)</li> <li>docs: Fix broken link warnings (<a href="https://redirect.github.com/tokio-rs/prost/issues/1056">#1056</a>)</li> <li>Add missing LICENSE symlink (<a href="https://redirect.github.com/tokio-rs/prost/issues/1086">#1086</a>)</li> </ul> <h2>Internal</h2> <ul> <li>workspace package metadata (<a href="https://redirect.github.com/tokio-rs/prost/issues/1036">#1036</a>)</li> <li>fix: Build error due to merge conflict (<a href="https://redirect.github.com/tokio-rs/prost/issues/1068">#1068</a>)</li> <li>build: Fix release scripts (<a href="https://redirect.github.com/tokio-rs/prost/issues/1055">#1055</a>)</li> <li>chore: Add ci to check MSRV (<a href="https://redirect.github.com/tokio-rs/prost/issues/1057">#1057</a>)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
|
|
8a29e5b1d4 |
chore(deps): Update base64 requirement from ~0.21 to ~0.22 (#690)
Updates the requirements on [base64](https://github.com/marshallpierce/rust-base64) to permit the latest version. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md">base64's changelog</a>.</em></p> <blockquote> <h1>0.22.0</h1> <ul> <li><code>DecodeSliceError::OutputSliceTooSmall</code> is now conservative rather than precise. That is, the error will only occur if the decoded output <em>cannot</em> fit, meaning that <code>Engine::decode_slice</code> can now be used with exactly-sized output slices. As part of this, <code>Engine::internal_decode</code> now returns <code>DecodeSliceError</code> instead of <code>DecodeError</code>, but that is not expected to affect any external callers.</li> <li><code>DecodeError::InvalidLength</code> now refers specifically to the <em>number of valid symbols</em> being invalid (i.e. <code>len % 4 == 1</code>), rather than just the number of input bytes. This avoids confusing scenarios when based on interpretation you could make a case for either <code>InvalidLength</code> or <code>InvalidByte</code> being appropriate.</li> <li>Decoding is somewhat faster (5-10%)</li> </ul> <h1>0.21.7</h1> <ul> <li>Support getting an alphabet's contents as a str via <code>Alphabet::as_str()</code></li> </ul> <h1>0.21.6</h1> <ul> <li>Improved introductory documentation and example</li> </ul> <h1>0.21.5</h1> <ul> <li>Add <code>Debug</code> and <code>Clone</code> impls for the general purpose Engine</li> </ul> <h1>0.21.4</h1> <ul> <li>Make <code>encoded_len</code> <code>const</code>, allowing the creation of arrays sized to encode compile-time-known data lengths</li> </ul> <h1>0.21.3</h1> <ul> <li>Implement <code>source</code> instead of <code>cause</code> on Error types</li> <li>Roll back MSRV to 1.48.0 so Debian can continue to live in a time warp</li> <li>Slightly faster chunked encoding for short inputs</li> <li>Decrease binary size</li> </ul> <h1>0.21.2</h1> <ul> <li>Rollback MSRV to 1.57.0 -- only dev dependencies need 1.60, not the main code</li> </ul> <h1>0.21.1</h1> <ul> <li>Remove the possibility of panicking during decoded length calculations</li> <li><code>DecoderReader</code> no longer sometimes erroneously ignores padding <a href="https://redirect.github.com/marshallpierce/rust-base64/issues/226">#226</a></li> </ul> <h2>Breaking changes</h2> <ul> <li><code>Engine.internal_decode</code> return type changed</li> <li>Update MSRV to 1.60.0</li> </ul> <h1>0.21.0</h1> <h2>Migration</h2> <h3>Functions</h3> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href=" |
||
|
|
f4013c5ac0 | fix: circular dependencies | ||
|
|
1a083f612a |
feat(convert): add derive macros for To and FromBytes (#667)
closes #661. - [x] docs - [x] tests - [x] depend on `extism-convert/extism-pdk-path` feature in https://github.com/extism/rust-pdk https://github.com/extism/rust-pdk/pull/47 |
||
|
|
211d55337d |
feat: add rust-protobuf support to extism-convert (#653)
(code from @zshipko, thank you!) --------- Co-authored-by: Zach Shipko <zach@dylibso.com> |
||
|
|
e5ffabb975 |
feat: Add extism_convert::Raw to allow direct encoding using bytemuck (#626)
- Adds `extism_convert::Raw` to encode certain types using their direct memory representations using https://github.com/Lokathor/bytemuck - Only enabled on little-endian targets to prevent memory mismatch issues - Allows for certain types of structs to be encoded using their in-memory representation - Makes passing structs between Rust and C easier since none of the other encodings are available in C by default. ## Usage After making a bytemuck-compatible struct: ```rust use bytemuck::{Zeroable, Pod}; #[derive(Debug, Clone, Copy, PartialEq, Pod, Zeroable)] #[repr(C)] struct Point { x: i32, y: i32, } ``` It can be used in `call`: ```rust let input = Point { x: 100, y: 50 }; let Raw(pt): Raw<Point> = plugin.call("transform", Raw(&input))?; ``` |
||
|
|
f7d297f98f |
build: drive crate versions from workspace; drive workspace version from ci (#604)
This is an attempt to sand down [a sharp edge](https://github.com/extism/extism/actions/runs/6949120346/job/18906546065#step:4:476) around releases – keeping the `Cargo.toml` versions in-sync with the release tag, & the versions of the workspace crates aligned with one another. |
||
|
|
d5c6ffb950 |
chore: loosen dependency requirements for base64 (#576)
Attempts to address an error seen when upgrading both Rust PDK & SDK to
latest:
```
Updating git repository `https://github.com/extism/extism.git`
Updating git repository `https://github.com/extism/rust-pdk.git`
Updating crates.io index
error: failed to select a version for `base64`.
... required by package `extism-convert v0.2.0 (https://github.com/extism/extism.git?branch=main#7636c873)`
... which satisfies git dependency `extism-convert` of package `extism v1.0.0-alpha.0 (https://github.com/extism/extism.git?branch=main#7636c873)`
... which satisfies git dependency `extism` of package `proto_core v0.22.4 (/Users/miles/Projects/proto/crates/core)`
... which satisfies path dependency `proto_core` (locked to 0.22.4) of package `proto_cli v0.22.0 (/Users/miles/Projects/proto/crates/cli)`
versions that meet the requirements `^0.21.3` are: 0.21.5, 0.21.4, 0.21.3
all possible versions conflict with previously selected packages.
previously selected package `base64 v0.21.0`
... which satisfies dependency `base64 = "^0.21.0"` (locked to 0.21.0) of package `extism-manifest v0.5.0`
... which satisfies dependency `extism-manifest = "^0.5.0"` (locked to 0.5.0) of package `extism-pdk v1.0.0-beta.0 (https://github.com/extism/rust-pdk.git?branch=main#009bf808)`
... which satisfies git dependency `extism-pdk` of package `proto_pdk v0.10.2 (/Users/miles/Projects/proto/crates/pdk)`
failed to select a version for `base64` which could resolve this conflict
```
|
||
|
|
bc56d7303a |
docs: Add readme, bump convert crate (#495)
Co-authored-by: zach <zach@dylibso.com> |
||
|
|
d994f081f9 |
chore: prepare extism-convert to be released (#494)
|
||
|
|
cb55e52506 |
feat: Add extism-convert crate and use it for input/output to plugin calls (#443)
- Adds `extism-convert` crate with `ToBytes`, `FromBytes` and `FromBytesOwned` traits - This serves as a single interface for reading/writing rich types from WebAssembly linear memory. - Supports `Json` and `Msgpack` and `Protobuf` encodings out-of-the-box - Updates `Plugin::call` to take `ToBytes` as the input argument and return a `FromBytes` value - Adds `host_fn!` macro to simplify host function creation - Cleans up generated documentation a little - PR for the Rust PDK: https://github.com/extism/rust-pdk/pull/31 - Adds a `typed_plugin!` macro to implement type-safe wrappers around `Plugin` - After this we should focus on adding similar type-conversion helpers to the SDKs and other PDKs to make it easier to use across languages. For example, a Python host running a Rust plugin using Msgpack encoded types. ## Examples ### Calling a function Instead of the untyped, bytes-only `call` function: ```rust let output = plugin.call("func_name", "my data").unwrap(); let output: MyType = serde_json::from_slice(&output).unwrap(); ``` We can now use richer types to encode/decode our values directly when using `call`: ```rust let Json(output) = plugin.call::<_, Json<MyType>>("func_name", "my data").unwrap(); ``` ### Allocating inside of a host function The same interface works for host functions, so instead of: ```rust fn hello_world( plugin: &mut CurrentPlugin, inputs: &[Val], outputs: &mut [Val], _user_data: UserData, ) -> Result<(), Error> { let handle = plugin.memory_handle_val(&inputs[0])?; let input = plugin.memory_read_str(handle)?; let output = plugin.memory_alloc_bytes(&input).unwrap(); outputs[0] = output.into(); Ok(()) } ``` Becomes: ```rust fn hello_world( plugin: &mut CurrentPlugin, inputs: &[Val], outputs: &mut [Val], _user_data: UserData, ) -> Result<(), Error> { let my_value: String = plugin.memory_get_val(&inputs[0])?; let output = plugin.memory_new(&my_value)?; outputs[0] = plugin.memory_to_val(output); Ok(()) } ``` Although this isn't much of an improvement, using the `host_fn` macro, we can really begin to see how the above function is really just an identity function: ```rust host_fn!(hello_world(a: String) -> String { a }); ``` ### typed_plugin! `typed_plugin!` is used to make a typed wrapper around a Plugin: ```rust /// Create the typed plugin typed_plugin!(Testing { count_vowels(&str) -> Json<Count> }); /// Create the `Plugin` and convert it to `Testing` wrapper let mut plugin: Testing = Plugin::new(WASM, [f], true).unwrap().into(); /// Call the `count_vowels` function: let Json(output0): Json<Count> = plugin.count_vowels("abc123")?; ``` It could make sense to convert `host_fn` and/or `typed_plugin` to proc-macros at some point, but for now they work and provide some flexibility in experimenting with the interfaces. Another future update could be to figure out a nice way to make it so input can be written in multiple chunks, so the entire input doesn't have to get copied into memory at once. |