Unverified Commit bb715296 authored by Katharina Fey's avatar Katharina Fey 🏴 Committed by GitHub
Browse files

Merge pull request #95 from belak/master

Fix compilation errors and remove unused sub-crate
parents 36b99053 b89c10da
/target/
**/*.rs.bk
Cargo.lock
[package]
name = "barrel_derives"
version = "0.0.0"
authors = ["Katharina Fey <kookie@spacekookie.de>"]
[lib]
proc-macro = true
[dependencies]
syn = { version = "^0.12", features = ["extra-traits"] }
quote = "^0.4"
\ No newline at end of file
//! A crate that handles some of the finer magical points of barrel error handling
//!
//! The idea behind this is that most programmer errors will be caught when
//! compiling the migrations, instead of during the runtime of a migration.
//!
//! This means less hassle on your production system and better testability 🎉
//!
//! More docs will follow here as the module matures
extern crate proc_macro;
extern crate syn;
#[macro_use]
extern crate quote;
use proc_macro::TokenStream;
use syn::DeriveInput;
#[proc_macro_derive(TextType)]
pub fn typed(input: TokenStream) -> TokenStream {
// Parse the input tokens into a syntax tree
let ast: DeriveInput = syn::parse(input).unwrap();
let name = &ast.ident;
panic!("name: {}", name);
// Build the output, possibly using quasi-quotation
let expanded = quote! {
};
// Hand the output tokens back to the compiler
expanded.into()
}
// extern crate proc_macro;
// extern crate syn;
// #[macro_use]
// extern crate quote;
// use proc_macro::TokenStream;
// #[proc_macro_derive(Typed)]
// pub fn column_type_check(input: TokenStream) -> TokenStream {
// let s = input.to_string();
// let ast = syn::parse(input).unwrap();
// panic!(s);
// // unimplemented!();
// }
// #[proc_macro_derive(HelloWorld)]
// pub fn hello_world(input: TokenStream) -> TokenStream {
// // Construct a string representation of the type definition
// let s = input.to_string();
// // Parse the string representation
// let ast = syn::parse_derive_input(&s).unwrap();
// // Build the impl
// let gen = impl_hello_world(&ast);
// // Return the generated impl
// gen.parse().unwrap()
// }
// fn impl_hello_world(ast: &syn::DeriveInput) -> quote::Tokens {
// let name = &ast.ident;
// quote! {
// impl HelloWorld for #name {
// fn hello_world() {
// println!("Hello, World! My name is {}", stringify!(#name));
// }
// }
// }
// }
\ No newline at end of file
......@@ -168,6 +168,7 @@ impl Migration {
sql.push_str(&sql_changes.indices.join(";"));
}
}
&mut CustomLine(ref line) => sql.push_str(line.as_str()),
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment