-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1864 from polywrap/nk/add-rs-app-template
feat: add rust app codegen template
- Loading branch information
Showing
11 changed files
with
114 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.15.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "template_app_rs" | ||
version = "0.1.0" | ||
license = "MIT" | ||
description = "Polywrap Rust App Template" | ||
edition = "2021" | ||
|
||
include = [ | ||
"src/wrap/*", | ||
"src/lib.rs" | ||
] | ||
|
||
[dependencies] | ||
polywrap = { version = "~0.1.8" } | ||
serde = {version = "1.0.145", features = ["derive"]} | ||
|
||
[dev-dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "template-app-rust", | ||
"private": true, | ||
"scripts": { | ||
"build": "npx polywrap codegen" | ||
}, | ||
"devDependencies": { | ||
"polywrap": "0.11.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#import * into Ipfs from "wrapscan.io/polywrap/ipfs-http-client@1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
format: 0.3.0 | ||
project: | ||
name: Sample | ||
type: app/rust | ||
source: | ||
schema: ./polywrap.graphql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
mod wrap; | ||
|
||
use polywrap::ByteBuf; | ||
use wrap::types::*; | ||
|
||
pub fn main() { | ||
let ipfs_provider = "https://ipfs.io"; | ||
let cid = "Qmc5gCcjYypU7y28oCALwfSvxCBskLuPKWpK4qpterKC7z"; | ||
let ipfs = IpfsModule::new(None, None, None); | ||
|
||
let data = ipfs.cat(&IpfsModuleArgsCat{ | ||
cid: cid.to_string(), | ||
ipfs_provider: ipfs_provider.to_string(), | ||
timeout: None, | ||
cat_options: None | ||
}, None, None, None).unwrap(); | ||
|
||
assert_eq!(data, ByteBuf::from("Hello World!\r\n".as_bytes().to_vec())); | ||
} | ||
|
||
#[cfg(test)] | ||
mod client_tests { | ||
|
||
#[test] | ||
fn test_client() { | ||
super::main(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters