pub fn from_path(path: &Path) -> io::Result<Self> {
        let name = path.display().to_string();
        let path = &path.canonicalize()?;

        let source = fs::read_to_string(path)?;
        let line_starts = line_starts(&source).collect::<Vec<_>>();

        Ok(Self {
            name,
            source,
            path: Some(path.to_owned()),
            line_starts,
        })
    }
/// Load a source from a path.
Load a source from a path.
Load a source from a path .
pub fn from_path(path: &Path) -> io::Result<Self> {
        let name = path.display().to_string();
        let path = &path.canonicalize()?;
        let source = fs::read_to_string(path)?;
        let line_starts = line_starts(&source).collect::<Vec<_>>();
        Ok(Self {
            name,
            source,
            path: Some(path.to_owned()),
            line_starts,
        })
    }
pub fn from_path ( path : & Path ) -> io :: Result < Self > { let name = path . display ( ) . to_string ( ) ; let path = & path . canonicalize ( ) ? ; let source = fs :: read_to_string ( path ) ? ; let line_starts = line_starts ( & source ) . collect :: < Vec < _ > > ( ) ; Ok ( Self { name , source , path : Some ( path . to_owned ( ) ) , line_starts , } ) }
Load a source from a path.
Load a source from a path .
path
&Path
path
&Path