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
Copy file name to clipboardExpand all lines: content/blog/announcing-spin-3-5.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ One thing you’ll notice the moment you try out the new SDK is that you’re us
54
54
<imgsrc="/static/image/blog/announcing-spin-3-5-gh-comment.png"alt="Bytecode Alliance member github comment on wasi-rs contribution">
55
55
</figure>
56
56
57
-
But that’s not where the interoperability story ends. Because of the design of the SDK in conjunction with the async support provided by WASIp3, it is now more seamless to bring your own web frameworks to use in Spin components. See for instance the Axum example [here](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/wasip3-http-axum-router). Historically, this was possible to do but required management of more lower level types. See the Axum example with WASIp2 [here](https://github.com/fermyon/wasi-hyperium/blob/main/examples/axum-server/src/lib.rs) for comparison. We’d love to hear more feedback on this experience through [GitHub issues](https://github.com/spinframework/spin-rust-sdk/issues), on [Slack](https://cloud-native.slack.com/archives/C089NJ9G1V0), or during [project meetings](https://github.com/spinframework/spin#getting-involved-and-contributing).
57
+
But that’s not where the interoperability story ends. Because of the design of the SDK in conjunction with the async support provided by WASIp3, it is now more seamless to bring your own web frameworks to use in Spin components. See for instance the Axum example [here](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/wasip3-http-axum-router). Historically, this was possible to do but required management of more lower level types. See the Axum example with WASIp2 [here](https://github.com/fermyon/wasi-hyperium/blob/main/examples/axum-server/src/lib.rs) for comparison. We’d love to hear more feedback on this experience through [GitHub issues](https://github.com/spinframework/spin-rust-sdk/issues), on [Slack](https://cloud-native.slack.com/archives/C089NJ9G1V0), or during [project meetings](https://github.com/spinframework/spin#getting-involved-and-contributing).
58
58
59
59
#### More on Language Support
60
60
@@ -84,7 +84,7 @@ You should now see a `hello-p3` directory containing a basic p3 application usin
84
84
85
85
### Deep Dive Into Example
86
86
87
-
The Rust SDK repo provides examples of things you can now do with p3 support. Let’s dive into one of them. With WASIp3 support in Spin, you can make concurrent outbound HTTP requests from within a component. See full example [here](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/wasip3-concurrent-outbound-http-calls).
87
+
The Rust SDK repo provides examples of things you can now do with p3 support. Let’s dive into one of them. With WASIp3 support in Spin, you can make concurrent outbound HTTP requests from within a component. See full example [here](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/wasip3-concurrent-outbound-http-calls).
88
88
89
89
The first step of using the SDK is opting into the `wasip3-unstable` feature as is done on the last line of the `Cargo.toml` file above. Also note Rust 1.90 and the `wasm32-wasip2` target are required to build WASIp3 components. (WASIp2 and p3 have the same binary representation, with p3 adding additional features. The `wasm32-wasip2` target causes the Rust compiler to emit the right binary format, with the SDK adding the additional p3 features.)
For an example of receiving the response in a streaming style, [see this example in the Spin repository](https://github.com/spinframework/spin-rust-sdk/blob/main/examples/wasi-http-streaming-outgoing-body/src/lib.rs).
91
+
For an example of receiving the response in a streaming style, [see this example in the Spin repository](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/wasi-http-streaming-outgoing-body/src/lib.rs).
Copy file name to clipboardExpand all lines: content/v2/rust-components.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -295,7 +295,7 @@ proxies or URL shorteners.
295
295
296
296
<!-- @searchTerm "async" -->
297
297
298
-
The Rust SDK [provides a router](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/http-router) that makes it easier to handle routing within a component:
298
+
The Rust SDK [provides a router](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/http-router) that makes it easier to handle routing within a component:
Copy file name to clipboardExpand all lines: content/v3/http-outbound.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,28 +28,28 @@ The outbound HTTP interface depends on your language.
28
28
29
29
{{ startTab "Rust"}}
30
30
31
-
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/http/index.html)
31
+
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/index.html)
32
32
33
-
To send requests, use the [`spin_sdk::http::send`](https://docs.rs/spin-sdk/latest/spin_sdk/http/fn.send.html) function. This takes a request argument and returns a response (or error). It is `async`, so within an async inbound handler you can have multiple outbound `send`s running concurrently.
33
+
To send requests, use the [`spin_sdk::http::send`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/fn.send.html) function. This takes a request argument and returns a response (or error). It is `async`, so within an async inbound handler you can have multiple outbound `send`s running concurrently.
34
34
35
35
> Support for streaming request and response bodies is **experimental**. We currently recommend that you stick with the simpler non-streaming interfaces if you don't require streaming.
36
36
37
37
`send` is quite flexible in its request and response types. The request may be:
38
38
39
39
*[`http::Request`](https://docs.rs/http/latest/http/request/struct.Request.html) - typically constructed via `http::Request::builder()`
40
-
*[`spin_sdk::http::Request`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.Request.html) - typically constructed via `spin_sdk::http::Request::get()`, `spin_sdk::http::Request::post()`, or `spin_sdk::http::Request::builder()`
41
-
* You can also use the [builder type](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.RequestBuilder.html) directly - `build` will be called automatically for you
42
-
*[`spin_sdk::http::OutgoingRequest`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.OutgoingRequest.html) - constructed via `OutgoingRequest::new()`
40
+
*[`spin_sdk::http::Request`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.Request.html) - typically constructed via `spin_sdk::http::Request::get()`, `spin_sdk::http::Request::post()`, or `spin_sdk::http::Request::builder()`
41
+
* You can also use the [builder type](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.RequestBuilder.html) directly - `build` will be called automatically for you
42
+
*[`spin_sdk::http::OutgoingRequest`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.OutgoingRequest.html) - constructed via `OutgoingRequest::new()`
43
43
* Any type for which you have implemented the `TryInto<spin_sdk::http::OutgoingRequest>` trait
44
44
45
45
Generally, you should use `OutgoingRequest` when you need to stream the outbound request body; otherwise, the `Request` types are usually simpler.
* Any type for which you have implemented the [spin_sdk::http::conversions::TryFromIncomingResponse](https://docs.rs/spin-sdk/latest/spin_sdk/http/conversions/trait.TryFromIncomingResponse.html) trait
* Any type for which you have implemented the [spin_sdk::http::conversions::TryFromIncomingResponse](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/conversions/trait.TryFromIncomingResponse.html) trait
53
53
54
54
Generally, you should use `IncomingResponse` when you need to stream the response body; otherwise, the `Response` types are usually simpler.
For an example of receiving the response in a streaming style, [see this example in the Spin repository](https://github.com/spinframework/spin-rust-sdk/blob/main/examples/wasi-http-streaming-outgoing-body/src/lib.rs).
90
+
For an example of receiving the response in a streaming style, [see this example in the Spin repository](https://github.com/spinframework/spin-rust-sdk/tree/v5.2.0/examples/wasi-http-streaming-outgoing-body/src/lib.rs).
Copy file name to clipboardExpand all lines: content/v3/http-trigger.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,9 +154,9 @@ The exact signature of the HTTP handler, and how a function is identified to be
154
154
155
155
{{ startTab "Rust"}}
156
156
157
-
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/http/index.html)
157
+
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/index.html)
158
158
159
-
In Rust, the handler is identified by the [`#[spin_sdk::http_component]`](https://docs.rs/spin-sdk/latest/spin_sdk/attr.http_component.html) attribute. The handler function can have one of two forms: _request-response_ or _input-output parameter_.
159
+
In Rust, the handler is identified by the [`#[spin_sdk::http_component]`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/attr.http_component.html) attribute. The handler function can have one of two forms: _request-response_ or _input-output parameter_.
160
160
161
161
**Request-Response Handlers**
162
162
@@ -174,15 +174,15 @@ In this form, nothing is sent to the client until the entire response is ready.
174
174
You have some flexibility in choosing the types of the request and response. The request may be:
* Any type for which you have implemented the [`spin_sdk::http::conversions::TryFromIncomingRequest`](https://docs.rs/spin-sdk/latest/spin_sdk/http/conversions/trait.TryFromIncomingRequest.html) trait
* Any type for which you have implemented the [`spin_sdk::http::conversions::TryFromIncomingRequest`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/conversions/trait.TryFromIncomingRequest.html) trait
180
180
181
181
The response may be:
182
182
183
183
*[`http::Response`](https://docs.rs/http/latest/http/response/struct.Response.html) - typically constructed via `Response::builder()`
184
-
*[`spin_sdk::http::Response`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.Response.html) - typically constructed via a [`ResponseBuilder`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.ResponseBuilder.html)
185
-
* Any type for which you have implemented the [`spin_sdk::http::IntoResponse`](https://docs.rs/spin-sdk/latest/spin_sdk/http/trait.IntoResponse.html) trait
184
+
*[`spin_sdk::http::Response`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.Response.html) - typically constructed via a [`ResponseBuilder`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.ResponseBuilder.html)
185
+
* Any type for which you have implemented the [`spin_sdk::http::IntoResponse`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/trait.IntoResponse.html) trait
186
186
* A `Result` where the success type is one of the above and the error type is `anyhow::Error` or another error type for which you have implemented `spin_sdk::http::IntoResponse` (such as `anyhow::Result<http::Response>`)
187
187
188
188
For example:
@@ -208,11 +208,11 @@ To extract data from the request, specify a body type as the generic parameter f
208
208
209
209
**Input-Output Parameter Handlers**
210
210
211
-
In this form, the handler function receives the request as an argument of type [`spin_sdk::http::IncomingRequest`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.IncomingRequest.html). It also receives an argument of type [`spin_sdk::http::ResponseOutparam`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.ResponseOutparam.html), through which is sends the response. The function does not return a value. This form is recommended for streaming responses.
211
+
In this form, the handler function receives the request as an argument of type [`spin_sdk::http::IncomingRequest`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.IncomingRequest.html). It also receives an argument of type [`spin_sdk::http::ResponseOutparam`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.ResponseOutparam.html), through which is sends the response. The function does not return a value. This form is recommended for streaming responses.
212
212
213
213
To send a response:
214
214
215
-
1. Create a [`spin_sdk::http::OutgoingResponse`](https://docs.rs/spin-sdk/latest/spin_sdk/http/struct.OutgoingResponse.html).
215
+
1. Create a [`spin_sdk::http::OutgoingResponse`](https://docs.rs/spin-sdk/5.2.0/spin_sdk/http/struct.OutgoingResponse.html).
216
216
2. Call `take_body()` on the `OutgoingResponse` - this gives you a [`futures::Sink`](https://docs.rs/futures/latest/futures/sink/trait.Sink.html) that you can later use to send data via the response.
217
217
3. Call `set` on the `ResponseOutparam`, passing the `OutgoingResponse`.
218
218
4. Call `send` on the `Sink` as many times as you like. Each send is carried out as you call it, so you can send the first part of the response without waiting for the whole response to be ready.
Copy file name to clipboardExpand all lines: content/v3/language-support-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ This page contains information about language support for Spin features:
13
13
14
14
{{ startTab "Rust"}}
15
15
16
-
**[📄 Visit the Rust Spin SDK reference documentation](https://docs.rs/spin-sdk/latest/spin_sdk/) to see specific modules, functions, variables and syntax relating to the following Rust features.**
16
+
**[📄 Visit the Rust Spin SDK reference documentation](https://docs.rs/spin-sdk/5.2.0/spin_sdk/) to see specific modules, functions, variables and syntax relating to the following Rust features.**
For full details of the MQTT API, see the [Spin SDK reference documentation](https://docs.rs/spin-sdk/latest/spin_sdk/mqtt/index.html);
52
+
For full details of the MQTT API, see the [Spin SDK reference documentation](https://docs.rs/spin-sdk/5.2.0/spin_sdk/mqtt/index.html);
53
53
54
54
You can find a complete Rust code example for using outbound MQTT from an HTTP component in the [Spin Rust SDK repository on GitHub](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/mqtt-outbound).
Copy file name to clipboardExpand all lines: content/v3/rdbms-storage.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ The exact detail of calling these operations from your application depends on yo
37
37
38
38
{{ startTab "Rust"}}
39
39
40
-
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/latest/spin_sdk/index.html)
40
+
> [**Want to go straight to the reference documentation?** Find it here.](https://docs.rs/spin-sdk/5.2.0/spin_sdk/index.html)
41
41
42
42
MySQL functions are available in the `spin_sdk::mysql` module, and PostgreSQL functions in the `spin_sdk::pg4` module.
43
43
@@ -73,7 +73,7 @@ match rowset.rows.first() {
73
73
74
74
You can find complete examples for using relational databases in the Spin repository on GitHub ([MySQL](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/mysql), [PostgreSQL](https://github.com/spinframework/spin-rust-sdk/tree/main/examples/postgres)).
75
75
76
-
For full information about the MySQL and PostgreSQL APIs, see [the Spin SDK reference documentation](https://docs.rs/spin-sdk/latest/spin_sdk/index.html).
76
+
For full information about the MySQL and PostgreSQL APIs, see [the Spin SDK reference documentation](https://docs.rs/spin-sdk/5.2.0/spin_sdk/index.html).
0 commit comments