Skip to content

Commit

Permalink
Update version to 0.3.0
Browse files Browse the repository at this point in the history
This version adds support for a new syntax:

`iprintln!("a: 0x" a;X ", b: 0x" b;X);`

Unlike the older literal-based syntax, this new syntax allows for better
error reporting from the compiler and better syntax highlighting from
editors not explicitly made aware of this macro (which, to my knowledge
at the time of writing, is all of them).

Unfortunately, due to the nature of macros, editors may not be able to
refactor the contents of ifmt macro calls (e.g. CLion does not appear to
rename any identifiers referenced within user-defined macros when doing
identifier find/replace) and will not provide any error checking without
explicit support.
  • Loading branch information
ct-austin committed Jan 13, 2020
1 parent 760d206 commit 422a6ba
Show file tree
Hide file tree
Showing 9 changed files with 511 additions and 159 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ifmt"
version = "0.2.0"
version = "0.3.0"
authors = ["ct-austin <c@ctaustin.me>"]
edition = "2018"
readme = "README.md"
Expand All @@ -9,8 +9,8 @@ description = "Inline expression interpolation for Rust."
license = "MIT/Apache-2.0"

[dependencies]
ifmt-impl = { version = "0.2", path = "impl" }
proc-macro-hack = "0.5"
ifmt-impl = { version = "0.3", path = "impl" }
proc-macro-hack = "0.5.10"

[workspace]
members = ["demo", "impl"]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ A small crate which brings inline string interpolation to rust's standard format
To use ifmt in your project, add
```toml
[dependencies]
ifmt = "0.2.0"
ifmt = "0.3.0"
```
to your Cargo.toml.

## Examples
```rust
let four = 4;
iprintln!("four plus four is: {four + 4}");
iprintln!("four plus four is: " four + 4);
// four plus four is: 8
iprintln!("here's a hex number: 0x{0xb0bi64 * 1321517i64 :x}");
iprintln!("here's a hex number: 0x" 0xb0bi64 * 1321517i64 ;x);
// here's a hex number: 0xdeadbeef
iprintln!("here's a debugging value: {Some(four):?}");
iprintln!("here's a debugging value: " Some(four);?);
// here's a debugging value: Some(4)
```

Expand Down
6 changes: 4 additions & 2 deletions demo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[package]
name = "demo"
version = "0.1.0"
version = "0.0.0"
authors = ["ct-austin <c@ctaustin.me>"]
edition = "2018"
publish = false

[dependencies]
ifmt = { version = "0.2.0", path = "../" }
ifmt = { version = "0.3.0", path = "../" }
lazy_static = "1.4.0"
6 changes: 3 additions & 3 deletions demo/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fn main() {
use ifmt::iprintln;
let four = 4;
iprintln!("four plus four is: {four + 4}");
iprintln!("four plus four is: " four + 4);
// four plus four is: 8
iprintln!("here's a hex number: 0x{0xb0bi64 * 1321517i64 :x}");
iprintln!("here's a hex number: 0x" 0xb0bi64 * 1321517i64 ;x);
// here's a hex number: 0xdeadbeef
iprintln!("here's a debugging value: {Some(four):?}");
iprintln!("here's a debugging value: " Some(four);?);
// here's a debugging value: Some(4)
}
10 changes: 5 additions & 5 deletions impl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ifmt-impl"
version = "0.2.0"
version = "0.3.0"
authors = ["ct-austin <c@ctaustin.me>"]
edition = "2018"
repository = "https://github.com/ct-austin/ifmt"
Expand All @@ -11,9 +11,9 @@ license = "MIT/Apache-2.0"
proc-macro = true

[dependencies]
syn = "0.15"
syn = { version = "1.0", features = ["full", "extra-traits"]}
regex = "1.1"
lazy_static = "1.3"
proc-macro2 = "0.4"
quote = "0.6"
lazy_static = "1.4"
proc-macro2 = "1.0.7"
quote = "1.0"
proc-macro-hack = "0.5"
Loading

0 comments on commit 422a6ba

Please sign in to comment.