Skip to main content

parse_property_arg

Function parse_property_arg 

Source
fn parse_property_arg(input: ParseStream<'_>) -> Result<Expr>
Expand description

Parse a single property argument as an Expr.

Arguments are usually types (Option<NonZero<T>>, [T; N], T), which syn cannot parse as value expressions (it would read </> as comparison operators), so we try Type first and wrap its token stream as Expr::Verbatim. Plain path types (single- or multi-segment identifiers without generics) are kept as Expr::Path so downstream place/ident resolution still recognises them. Arguments that are genuine expressions (0, x + 1, ptr.0) fail type parsing and fall back to Expr.