Skip to content

Commit

Permalink
Build -> Dev
Browse files Browse the repository at this point in the history
Probably shouldn't force users to install ureq from a unit test..
  • Loading branch information
DvvCz committed Jan 6, 2023
1 parent e75e943 commit 08e383d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name = "constime"
authors = ["David Cruz <davidccodes@gmail.com>"]
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"

[lib]
proc-macro = true
doctest = false

[build-dependencies]
[dev-dependencies]
ureq = "2.6.1"
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ This is a tiny alternative to <https://github.com/nhynes/comptime-rs>, 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

Expand Down
1 change: 0 additions & 1 deletion build.rs

This file was deleted.

3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![doc = include_str!("../README.md")]

extern crate proc_macro;
use proc_macro::TokenStream;
use std::hash::{Hash, Hasher};
Expand All @@ -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();
Expand Down

0 comments on commit 08e383d

Please sign in to comment.