Skip to main content

type_display

Function type_display 

Source
pub(crate) fn type_display(ty: &Type) -> String
Expand description

Render a type the way it is written in Rust source, for user-facing messages: AsFromStrVec<i32>, Either<i32, String>, &[f64], &'a str, Option<Vec<String>>.

quote!(#ty).to_string() puts a space between every token (AsFromStrVec < i32 >); this walks the tokens and applies the usual spacing instead: none around <, >, ::, after & / * / ', or inside brackets; a space after , / ;, around + / = / ->, between two words, and between mut / const / dyn / impl or a lifetime and a following bracket group (&mut [T], &'a [T]).