fn generate_ast_vector_data(
    path: PathBuf,
    file_type: Option<&str>,
    grammar_config: &GrammarConfig,
) -> Result<AstVectorData> {
    let text = fs::read_to_string(&path)?;
    let file_name = path.to_string_lossy();
    debug!("Reading {} to string", file_name);

    if let Some(file_type) = file_type {
        info!(
            "Using user-set filetype \"{}\" for {}",
            file_type, file_name
        );
    } else {
        info!("Will deduce filetype from file extension");
    };
    let tree = parse::parse_file(&path, file_type, grammar_config)?;
    Ok(AstVectorData { text, tree, path })
}
/// Create an AST vector from a path
///
/// This returns an AstVector and a pinned struct with the owned data, which the AstVector
/// references.
///
/// `data` is used as an out-parameter. We need some external struct we can reference because the
/// return type references the data in that struct.
Create an AST vector from a path
This returns an AstVector and a pinned struct with the owned data, which the AstVector
references.

`data` is used as an out-parameter. We need some external struct we can reference because the
return type references the data in that struct.
Create an AST vector from a path This returns an AstVector and a pinned struct with the owned data which the AstVector references . ` data ` is used as an out - parameter . We need some external struct we can reference because the return type references the data in that struct .
fn generate_ast_vector_data(
    path: PathBuf,
    file_type: Option<&str>,
    grammar_config: &GrammarConfig,
) -> Result<AstVectorData> {
    let text = fs::read_to_string(&path)?;
    let file_name = path.to_string_lossy();
    debug!("Reading {} to string", file_name);
    if let Some(file_type) = file_type {
        info!(
            "Using user-set filetype \"{}\" for {}",
            file_type, file_name
        );
    } else {
        info!("Will deduce filetype from file extension");
    };
    let tree = parse::parse_file(&path, file_type, grammar_config)?;
    Ok(AstVectorData { text, tree, path })
}
fn generate_ast_vector_data ( path : PathBuf , file_type : Option < & str > , grammar_config : & GrammarConfig , ) -> Result < AstVectorData > { let text = fs :: read_to_string ( & path ) ? ; let file_name = path . to_string_lossy ( ) ; debug ! ( " " file_name ) ; if let Some ( file_type ) = file_type { info ! ( " \" \" " file_type file_name ) ; } else { info ! ( " " ) ; } ; let tree = parse :: parse_file ( & path , file_type , grammar_config ) ? ; Ok ( AstVectorData { text , tree , path } ) }
Create an AST vector from a path
This returns an AstVector and a pinned struct with the owned data, which the AstVector
references.
Create an AST vector from a path This returns an AstVector and a pinned struct with the owned data which the AstVector references .
path
PathBuf
file_type
Option<&str>
grammar_config
&GrammarConfig
path
PathBuf
file_type
Option<&str>
grammar_config
&GrammarConfig