This commit is contained in:
Michael Zhang 2020-01-10 01:26:38 -06:00
commit ffd34f6fdf
No known key found for this signature in database
GPG key ID: 5BAEFE5D04F0CE6C
10 changed files with 131 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/target
**/*.rs.bk

46
Cargo.lock generated Normal file
View file

@ -0,0 +1,46 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "enterprise"
version = "0.1.0"
[[package]]
name = "enterprise-macros"
version = "0.1.0"
dependencies = [
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "todomvc"
version = "0.1.0"
dependencies = [
"enterprise 0.1.0",
"enterprise-macros 0.1.0",
]
[[package]]
name = "unicode-xid"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0319972dcae462681daf4da1adeeaa066e3ebd29c69be96c6abb1259d2ee2bcc"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"

10
Cargo.toml Normal file
View file

@ -0,0 +1,10 @@
[package]
name = "enterprise"
version = "0.1.0"
authors = ["Michael Zhang <iptq@protonmail.com>"]
edition = "2018"
[workspace]
members = ["enterprise-macros", "todomvc"]
[dependencies]

View file

@ -0,0 +1,11 @@
[package]
name = "enterprise-macros"
version = "0.1.0"
authors = ["Michael Zhang <iptq@protonmail.com>"]
edition = "2018"
[lib]
proc-macro = true
[dependencies]
quote = "1.0.2"

View file

@ -0,0 +1,11 @@
extern crate proc_macro;
use quote::quote;
use proc_macro::TokenStream;
#[proc_macro]
pub fn component(input_tokens: TokenStream) -> TokenStream {
let tokens = quote! {
};
tokens.into()
}

11
src/backend.rs Normal file
View file

@ -0,0 +1,11 @@
pub trait Backend {
}
pub struct WebBackend {
}
impl Backend for WebBackend {
}

0
src/lib.rs Normal file
View file

3
src/widgets/mod.rs Normal file
View file

@ -0,0 +1,3 @@
pub trait Widget<B> {
}

9
todomvc/Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "todomvc"
version = "0.1.0"
authors = ["Michael Zhang <iptq@protonmail.com>"]
edition = "2018"
[dependencies]
enterprise = { path = ".." }
enterprise-macros = { path = "../enterprise-macros" }

28
todomvc/src/main.rs Normal file
View file

@ -0,0 +1,28 @@
use enterprise_macros::component;
component! {
data {
}
markup {
<Header>
<H1>Todos</H1>
<TextBox
/>
</Header>
{#if items.length > 0}
<Section class="main">
<List>
{#for item in items}
{/for}
</List>
</Section>
{/if}
}
}
fn main() {
println!("Hello, world!");
}