pub struct Scan { /* private fields */ }Expand description
Package dependency scanner.
Discovers all dependencies for a set of packages and resolves them into a buildable set with proper ordering.
§Usage
- Create a
ScanwithScan::new - Add packages to scan with
Scan::add - Run the scan with
Scan::start - Resolve dependencies with
Scan::resolve
§Example
let config = Config::load(None, false)?;
let mut scan = Scan::new(&config);
scan.add(&PkgPath::new("mail/mutt")?);
let ctx = RunContext::new(Arc::new(AtomicBool::new(false)));
scan.start(&ctx)?;
let result = scan.resolve(None)?;
println!("Found {} buildable packages", result.buildable.len());Implementations§
Source§impl Scan
impl Scan
pub fn new(config: &Config) -> Scan
pub fn add(&mut self, pkgpath: &PkgPath)
pub fn start(&mut self, ctx: &RunContext) -> Result<bool>
Sourcepub fn scan_errors(&self) -> Vec<String>
pub fn scan_errors(&self) -> Vec<String>
Returns scan failures as formatted error strings.
Sourcepub fn scan_failures(&self) -> &[(PkgPath, String)]
pub fn scan_failures(&self) -> &[(PkgPath, String)]
Returns scan failures with pkgpath information.
Sourcepub fn scanned(&self) -> impl Iterator<Item = &ScanIndex>
pub fn scanned(&self) -> impl Iterator<Item = &ScanIndex>
Get all scanned packages (before resolution).
Sourcepub fn write_log(&self, path: &Path) -> Result<()>
pub fn write_log(&self, path: &Path) -> Result<()>
Write scan output to a file in FOO=bar format.
Sourcepub fn resolve(&mut self, log_dir: Option<&Path>) -> Result<ScanResult>
pub fn resolve(&mut self, log_dir: Option<&Path>) -> Result<ScanResult>
Resolve the list of scanned packages, by ensuring all of the Depend
patterns in all_depends match a found package, and that there are no
circular dependencies. The best match for each is stored in the
depends for the package in question.
Return a ScanResult containing buildable packages and skipped packages.
If log_dir is provided, logs will be written even on failure.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scan
impl !RefUnwindSafe for Scan
impl Send for Scan
impl Sync for Scan
impl Unpin for Scan
impl !UnwindSafe for Scan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more