mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-21 11:20:03 +00:00
Run Manifest
parsing in block_in_place
mode
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
60caa9ee17
commit
e18ac6e117
4 changed files with 25 additions and 27 deletions
|
@ -29,23 +29,11 @@ impl ManifestVisitor {
|
|||
vfs: Vfs::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Load binstall metadata using the extracted information stored in memory.
|
||||
pub(super) fn load_manifest(&self) -> Result<Manifest<Meta>, BinstallError> {
|
||||
debug!("Loading manifest directly from extracted file");
|
||||
|
||||
// Load and parse manifest
|
||||
let mut manifest = Manifest::<Meta>::from_slice_with_metadata(&self.cargo_toml_content)?;
|
||||
|
||||
// Checks vfs for binary output names
|
||||
manifest.complete_from_abstract_filesystem(&self.vfs)?;
|
||||
|
||||
// Return metadata
|
||||
Ok(manifest)
|
||||
}
|
||||
}
|
||||
|
||||
impl TarEntriesVisitor for ManifestVisitor {
|
||||
type Target = Manifest<Meta>;
|
||||
|
||||
fn visit<R: Read>(&mut self, entries: Entries<'_, R>) -> Result<(), BinstallError> {
|
||||
for res in entries {
|
||||
let mut entry = res?;
|
||||
|
@ -78,4 +66,18 @@ impl TarEntriesVisitor for ManifestVisitor {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Load binstall metadata using the extracted information stored in memory.
|
||||
fn finish(self) -> Result<Self::Target, BinstallError> {
|
||||
debug!("Loading manifest directly from extracted file");
|
||||
|
||||
// Load and parse manifest
|
||||
let mut manifest = Manifest::from_slice_with_metadata(&self.cargo_toml_content)?;
|
||||
|
||||
// Checks vfs for binary output names
|
||||
manifest.complete_from_abstract_filesystem(&self.vfs)?;
|
||||
|
||||
// Return metadata
|
||||
Ok(manifest)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue