Skip to content

Commit 54f5686

Browse files
committed
feat: initial commit
0 parents  commit 54f5686

File tree

8 files changed

+613
-0
lines changed

8 files changed

+613
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
/Cargo.lock

Cargo.toml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[package]
2+
name = "rusty_engine"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[lib]
7+
crate-type = ["rlib", "cdylib"]
8+
9+
[dependencies]
10+
js-sys = "0.3.60"
11+
serde = { version = "1.0.147", features = ["derive"] }
12+
serde-wasm-bindgen = "0.4.5"
13+
thiserror = "1.0.37"
14+
wasm-bindgen = "0.2.83"
15+
web-sys = { version = "0.3.60", features = ["console"] }
16+
17+
[dev-dependencies]
18+
wasm-bindgen-test = "0.3.33"

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# rusty_engine
2+
3+
A Javascript templating engine in WASM.

src/error.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use thiserror::Error;
2+
use wasm_bindgen::JsValue;
3+
4+
pub type Result<T> = std::result::Result<T, RenderError>;
5+
6+
#[derive(Error, Debug, PartialEq)]
7+
pub enum RenderError {
8+
#[error("Syntax error")]
9+
SyntaxError,
10+
#[error("Function error")]
11+
FunctionError,
12+
#[error("Missing command tag")]
13+
MissingCommandTag,
14+
#[error("Missing closing tag")]
15+
MissingClosingTag,
16+
}
17+
18+
impl Into<JsValue> for RenderError {
19+
fn into(self) -> JsValue {
20+
self.to_string().into()
21+
}
22+
}

0 commit comments

Comments
 (0)