Skip to main content

parse_one_def_block

Function parse_one_def_block 

Source
fn parse_one_def_block(s: &str) -> (Option<DefSpec>, usize)
Expand description

Parse a single leading Name(p: Ptr, T: Ty, ...) { body } block from s. Returns the DefSpec (without doc) and the number of bytes consumed through the closing }.

The block is emitted by the pred! proc-macro as a single line of space-separated tokens, so parameter names and role annotations (Ptr, Ty, Expr, Ident) are split on : and , after trimming whitespace. The braces delimit the body, so nested ==/<= inside a ValidNum predicate cannot be confused with a definition separator.