mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 10:21:53 +00:00
fix locking logic
This commit is contained in:
16
patch-db-derive/Cargo.toml
Normal file
16
patch-db-derive/Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "patch-db-derive"
|
||||
version = "0.1.0"
|
||||
authors = ["Aiden McClelland <me@drbonez.dev>"]
|
||||
edition = "2018"
|
||||
description = "derive macros for defining typed patch dbs"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/dr-bonez/patch-db"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
patch-db-derive-internals = { path = "../patch-db-derive-internals" }
|
||||
syn = "1.0.62"
|
||||
13
patch-db-derive/src/lib.rs
Normal file
13
patch-db-derive/src/lib.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
#[proc_macro_derive(Model, attributes(serde))]
|
||||
pub fn model_derive(input: TokenStream) -> TokenStream {
|
||||
// Construct a representation of Rust code as a syntax tree
|
||||
// that we can manipulate
|
||||
let ast = syn::parse(input).unwrap();
|
||||
|
||||
// Build the trait implementation
|
||||
patch_db_derive_internals::build_model(&ast).into()
|
||||
}
|
||||
Reference in New Issue
Block a user