You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust workers return a http::Response object that it's lately serialized into a UTF-8 JSON string. Then, the JSON is returned to the main wws service via WASI stdout. Note that the current seralized JSON includes the body and any other related metadata such as headers and status code.
This beahvior limits the capabilities of the workers as some tasks may return non UTF-8 entities. For example, we may want to generate a binary file that can be represented with a Vec<u8> in Rust, but not as a String. For this reason, we plan to add support for an array of bytes (Vec<u8>) in Rust workers too. This will introduce a breaking change as the Rust kit assumes the worker will return a String.
Supporting multiple values in Rust is simple, although we still need to make it serializable to JSON. To accomplish this, we plan to encode non-String values with base64. This is an initial iteration as base64 will introduce a performance penalty. In the future, we will stop using JSON in favor of other formats that supports all the use cases without base64.
The text was updated successfully, but these errors were encountered:
Rust workers return a
http::Response
object that it's lately serialized into aUTF-8 JSON
string. Then, the JSON is returned to the mainwws
service via WASIstdout
. Note that the current seralized JSON includes the body and any other related metadata such as headers and status code.This beahvior limits the capabilities of the workers as some tasks may return non UTF-8 entities. For example, we may want to generate a binary file that can be represented with a
Vec<u8>
in Rust, but not as aString
. For this reason, we plan to add support for an array of bytes (Vec<u8>
) in Rust workers too. This will introduce a breaking change as the Rust kit assumes the worker will return aString
.Supporting multiple values in Rust is simple, although we still need to make it serializable to JSON. To accomplish this, we plan to encode non-String values with
base64
. This is an initial iteration asbase64
will introduce a performance penalty. In the future, we will stop using JSON in favor of other formats that supports all the use cases withoutbase64
.The text was updated successfully, but these errors were encountered: