Skip to content

Releases: dtolnay/quote

0.3.4

23 Oct 20:17
0.3.4
02a7209
Compare
Choose a tag to compare
  • Allow equality comparison of Tokens by implementing Eq, which is now more meaningful since the whitespace-related fixes in 0.3.1 and 0.3.3

0.3.3

09 Oct 21:54
0.3.3
e37af76
Compare
Choose a tag to compare
  • Avoid one more case of extra spaces (#9, thanks @mystor)

0.3.2

09 Oct 21:35
0.3.2
a6ad232
Compare
Choose a tag to compare
  • Support empty quote!() call. It returns an empty tokens string. (#6, thanks @mystor)

0.3.1

09 Oct 21:34
0.3.1
3da67b5
Compare
Choose a tag to compare
  • Avoid extra spaces in the tokens string. Previously some token strings would have 2 or 3 consecutive spaces in places. Now there will always be 1 space between tokens which makes it easier to unit test output from the quote! macro. (#5, thanks @mystor)

0.3.0

08 Oct 22:32
0.3.0
b058bc8
Compare
Choose a tag to compare
  • Extend the repetition syntax and align it more closely with the style of macro_rules! repetitions. This is a breaking change and code that used to look like #(var)* needs to be updated to #(#var)*.

Some examples of the new repetition style:

let keys = vec!["a", "b"];
let values = vec![true, false];

// "a": true, "b": false
quote! {
    #(#keys: #values),*
}
let nested = vec![
    vec!['a', 'b', 'c'],
    vec!['x', 'y', 'z'],
];

// 'a' 'b' 'c', 'x' 'y' 'z'
quote! {
    #(
        #(#nested)*
    ),*
}

In general it should feel just like macro_rules! repetitions except with # instead of $. The remaining limitations are:

  • Cannot mix repeating and non-repeating tokens at the same level. If #a is repeating (like a Vec) and #b is not, then quote! { #(#a #b)* } will not work. Ideally it would insert the same #b for each #a the way macro_rules! does but I have not figured this out yet. For now you can explicitly repeat b using std::iter::repeat.
  • Cannot repeat the same tokens more than once at the same repetition level. quote! { #a #a } continues to work as before but I have not figured out a way to support quote! { #(#a #a)* }.

0.3.0-rc2

08 Oct 17:52
0.3.0-rc2
6b4c370
Compare
Choose a tag to compare
0.3.0-rc2 Pre-release
Pre-release
Release 0.3.0-rc2

0.3.0-rc1

08 Oct 17:52
0.3.0-rc1
d729fbf
Compare
Choose a tag to compare
0.3.0-rc1 Pre-release
Pre-release
Release 0.3.0-rc1

0.2.3

05 Oct 06:43
0.2.3
be07057
Compare
Choose a tag to compare

0.2.2

04 Oct 04:17
0.2.2
Compare
Choose a tag to compare
  • Allow types other than Vec to be used with the $(var)* syntax

0.2.1

02 Oct 17:07
0.2.1
838fe58
Compare
Choose a tag to compare
  • Add an impl allowing Box to be quoted as though it were T.

    let b = Box::new(x);
    quote! {
        original: #x,
        boxed: #b // same as original
    }