source_from_path

Function source_from_path 

Source
pub fn source_from_path(path: &Path) -> Result<SourceText, OakError>
Expand description

Reads source text from a file path.

This function reads the contents of a file and creates a SourceText with the appropriate URL metadata. It’s a convenience function for loading source files into the parsing system.

§Arguments

  • path - The file system path to read from

§Returns

A Result containing the SourceText if successful, or an OakError if reading fails

§Examples

let path = std::path::Path::new("source.rs");
let source = source_from_path(path)?;