commit | b11167d499db15a23e1eb28ef36b22efc72413f5 | [log] [tgz] |
---|---|---|
author | David Tolnay <dtolnay@gmail.com> | Tue Sep 27 09:50:55 2016 -0700 |
committer | David Tolnay <dtolnay@gmail.com> | Tue Sep 27 09:50:55 2016 -0700 |
tree | b12ea9ca8e12b3caa754b76e0e497fe6ac335ef2 | |
parent | 7e048938ea9a619acf0cbc65a78d0014c500132f [diff] |
Release 0.2.0
Quasi-quoting without a Syntex dependency, intended for use with Macros 1.1.
[dependencies] quote = "0.2"
#[macro_use] extern crate quote;
Interpolation is done with #var
:
let tokens = quote! { struct SerializeWith #generics #where_clause { value: &'a #field_ty, phantom: ::std::marker::PhantomData<#item_ty>, } impl #generics serde::Serialize for SerializeWith #generics #where_clause { fn serialize<S>(&self, s: &mut S) -> Result<(), S::Error> where S: serde::Serializer { #path(self.value, s) } } SerializeWith { value: #value, phantom: ::std::marker::PhantomData::<#item_ty>, } };
Repetition is done in one of three ways, similar to macro_rules!
repetitions:
#(var)*
- no separators#(var),*
- the character before the asterisk is used as a separator#(var;)*
- the character before the close paren is used as a terminatorLicensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.