Skip to main content

source

Function source 

Source
pub fn source(id_or_file: &str, name: Option<&str>) -> Result<SourceResult>
Expand description

Return the full source text of one symbol.

  • id_or_file — either a symbol id (<lang>:<path>#<name>@<line>) or, when name is Some, the path to the file containing the symbol.
  • name — when Some, look the symbol up by this name in id_or_file; when None, parse id_or_file as a full symbol id.

Returns a SourceResult with the chosen symbol’s source plus any other_candidates that shared the name (for disambiguation). The @<line> suffix of an id selects among duplicates; otherwise the first definition wins. Errors on a malformed id or when no matching definition exists.