diff --git a/Cargo.toml b/Cargo.toml index 6b12a53..59506e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "constime" authors = ["David Cruz "] repository = "https://github.com/DvvCz/Constime" description = "Zig's comptime for Rust with zero dependencies. Mostly something to play around with until more stuff is const fn." -version = "0.2.1" +version = "0.2.2" edition = "2021" license = "MIT" @@ -11,5 +11,5 @@ license = "MIT" proc-macro = true doctest = false -[build-dependencies] +[dev-dependencies] ureq = "2.6.1" diff --git a/README.md b/README.md index d2c31dd..64f31f4 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,9 @@ This is a tiny alternative to , with no d cargo add constime ``` -Note that in order to use dependencies in `comptime!`, you must either: -* Have it as a normal dependency in `[dependencies]`. -* Have it as a build dependency in `[build-dependencies]`, alongside: - * A `build.rs` file to make rust compiles the dependencies. - * Explicitly importing the crate using `extern crate`. +Dependencies in `comptime!` can be stored in either `[dependencies]` or `[build-dependencies]`, and must be explicitly imported using `extern crate`. + +You will also need a build.rs file in order to force `[build-dependencies]` to compile. ## Example diff --git a/build.rs b/build.rs deleted file mode 100644 index e71fdf5..0000000 --- a/build.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 3de100e..72c4ba9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![doc = include_str!("../README.md")] + extern crate proc_macro; use proc_macro::TokenStream; use std::hash::{Hash, Hasher}; @@ -20,6 +22,7 @@ pub fn comptime(code: TokenStream) -> TokenStream { }; let code = format!("fn main(){{ println!(\"{{:?}}\", {{ {code} }}) }}"); + let mut hash = std::collections::hash_map::DefaultHasher::new(); code.hash(&mut hash); let hash = hash.finish();