pub fn from_disk(res: DirectRes, path: DirLock) -> Res<Self> {
        let id = IndexRes { res };
        let pn = path.path().join("index.toml");
        let file = fs::File::open(&pn)
            .with_context(|e| format_err!("couldn't open index config {}: {}", pn.display(), e))?;
        let mut file = BufReader::new(file);
        let mut contents = String::new();
        file.read_to_string(&mut contents)
            .with_context(|e| format_err!("couldn't read index config {}: {}", pn.display(), e))?;
        let config = IndexConfig::from_str(&contents)?;

        Ok(Index { id, path, config })
    }
/// Creates a new empty package index directly from a Url and a local path.
Creates a new empty package index directly from a Url and a local path.
Creates a new empty package index directly from a Url and a local path .
pub fn from_disk(res: DirectRes, path: DirLock) -> Res<Self> {
        let id = IndexRes { res };
        let pn = path.path().join("index.toml");
        let file = fs::File::open(&pn)
            .with_context(|e| format_err!("couldn't open index config {}: {}", pn.display(), e))?;
        let mut file = BufReader::new(file);
        let mut contents = String::new();
        file.read_to_string(&mut contents)
            .with_context(|e| format_err!("couldn't read index config {}: {}", pn.display(), e))?;
        let config = IndexConfig::from_str(&contents)?;
        Ok(Index { id, path, config })
    }
pub fn from_disk ( res : DirectRes , path : DirLock ) -> Res < Self > { let id = IndexRes { res } ; let pn = path . path ( ) . join ( " " ) ; let file = fs :: File :: open ( & pn ) . with_context ( | e | format_err ! ( " " pn display ( ) e ) ) ? ; let mut file = BufReader :: new ( file ) ; let mut contents = String :: new ( ) ; file . read_to_string ( & mut contents ) . with_context ( | e | format_err ! ( " " pn display ( ) e ) ) ? ; let config = IndexConfig :: from_str ( & contents ) ? ; Ok ( Index { id , path , config } ) }
Creates a new empty package index directly from a Url and a local path.
Creates a new empty package index directly from a Url and a local path .
res
DirectRes
path
DirLock