mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
more tutorial
This commit is contained in:
33
examples/tutorial/hello/rust/README.md
Normal file
33
examples/tutorial/hello/rust/README.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Using rust with functions
|
||||
|
||||
The easiest way to create a function in rust is via ***cargo*** and ***fn***.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
First create an epty rust project as follows:
|
||||
|
||||
```bash
|
||||
cargo init --name func --bin
|
||||
```
|
||||
|
||||
Make sure the project name is ***func*** and is of type ***bin***. Now just edit your code, once done you can create a function.
|
||||
|
||||
## Creating a function
|
||||
|
||||
Simply run
|
||||
|
||||
```bash
|
||||
fn init --runtime=rust <username>/<funcname>
|
||||
```
|
||||
|
||||
This will create the ```func.yaml``` file required by functions, which can be built by running:
|
||||
|
||||
```bash
|
||||
fn build
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
```bash
|
||||
fn run
|
||||
```
|
||||
Reference in New Issue
Block a user