Skip to content

Releases: dtolnay/quote

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
    }

0.2.0

27 Sep 17:42
0.2.0
b11167d
Compare
Choose a tag to compare

This release changes the handling of primitive integer and floating point types to match the behavior of quasi.

let int: u64 = 100;
quote!(#int)

In 0.1 this would quote as "100". In 0.2 it quotes as "100u64". Similar for i8, i16, i32, i64, isize, u8, u16, u32, usize, f32, f64.

0.1.4

23 Sep 21:42
0.1.4
Compare
Choose a tag to compare
0.1.4 Pre-release
Pre-release
Release 0.1.4