File: dependency.rs

package info (click to toggle)
rust-ognibuild 0.2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,616 kB
  • sloc: makefile: 17
file content (24 lines) | stat: -rw-r--r-- 862 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::session::Session;

/// A dependency is a component that is required by a project to build or run.
pub trait Dependency: std::fmt::Debug {
    /// Get the family of this dependency (e.g., "apt", "pip", etc.).
    ///
    /// # Returns
    /// A string identifying the dependency type family
    fn family(&self) -> &'static str;

    /// Check whether the dependency is present in the session.
    fn present(&self, session: &dyn Session) -> bool;

    /// Check whether the dependency is present in the project.
    fn project_present(&self, session: &dyn Session) -> bool;

    /// Convert this dependency to Any for dynamic casting.
    ///
    /// This method allows for conversion of the dependency to concrete types at runtime.
    ///
    /// # Returns
    /// A reference to this dependency as Any
    fn as_any(&self) -> &dyn std::any::Any;
}