Skip to main content

annotation_insert_offset

Function annotation_insert_offset 

Source
pub fn annotation_insert_offset(
    source: &str,
    param: &UnannotatedParam,
) -> Option<usize>
Expand description

Byte offset where : Type belongs for this parameter, or None when the span does not contain the parameter name (a synthetic parameter, or a span that does not line up with source).

The annotation goes directly after the name, which is after any ... and before any = default. Both writers of an annotation — the checker’s suggested fix and the harn fix migration — use this offset, so a parameter can never be annotated in two different places.