spin
spin copied to clipboard
Rust instructions don't tell how to cargo init the project
The docs do not say how to cargo init
a project. If you are doing a cargo init
for a spin package, you need to do cargo init --lib
and then it appears that at minimum you need to add the following to your Cargo.toml
:
[lib]
crate-type = [ "cdylib" ]
[dependencies]
# Useful crate to handle errors.
anyhow = "1"
# Crate to simplify working with bytes.
bytes = "1"
# General-purpose crate with common HTTP types.
http = "0.2"
# The Spin SDK.
spin-sdk = { git = "https://github.com/fermyon/spin" }
# Crate that generates Rust Wasm bindings from a WebAssembly interface.
wit-bindgen-rust = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "2f46ce4cc072107153da0cefe15bdc69aa5b84d0" }
(I'm not entirely sure whether anyhow
is actually required. It probably is not. But leaving out any of the rest causes the macros to barf.)
This is primarily intended to be covered by templates (ref #186 and #273), but I can also see the appeal in having a documentation section describing how to initialize from scratch.
Yeah, if the templates take care of it, that's fine.
The templates do take care of it, so closing. Please reopen if anyone feels we should publish manual instructions too!