pub fn unpretty_print<T: Display>(ts: T) -> String
Expand description
Dumps an unpretty version of a tokenstream. Takes any type which implements
Display
.
This is mostly useful for visualizing the output of a procedural macro, as
it makes it marginally more readable. It is used in the implementation of
test_derive!
to unprettily print the output.
§Stability
The stability of the output of this function is not guaranteed. Do not assert that the output of this function does not change between minor versions.
§Example
assert_eq!(
synstructure::unpretty_print(quote! {
const _: () = {
extern crate krate;
impl<T, U> krate::Trait for A<T, U>
where
Option<U>: krate::Trait,
U: krate::Trait
{
fn a() {}
}
};
}),
"const _ : (
)
= {
extern crate krate ;
impl < T , U > krate :: Trait for A < T , U > where Option < U > : krate :: Trait , U : krate :: Trait {
fn a (
)
{
}
}
}
;
"
)