fn count_rpm() -> Option<usize> {
        // Return the number of installed packages using sqlite (~1ms)
        // as directly calling rpm or dnf is too expensive (~500ms)
        let db = "/var/lib/rpm/rpmdb.sqlite";
        if !Path::new(db).is_file() {
            return None;
        }

        let connection = sqlite::open(db);
        if let Ok(con) = connection {
            let statement = con.prepare("SELECT COUNT(*) FROM Installtid");
            if let Ok(mut s) = statement {
                if s.next().is_ok() {
                    return match s.read::<Option<i64>>(0) {
                        Ok(Some(count)) => Some(count as usize),
                        _ => None,
                    };
                }
            }
        }

        None
    }
/// Returns the number of installed packages for systems
/// that utilize `rpm` as their package manager.
Returns the number of installed packages for systems
that utilize `rpm` as their package manager.
Returns the number of installed packages for systems that utilize ` rpm ` as their package manager .
fn count_rpm() -> Option<usize> {
        // Return the number of installed packages using sqlite (~1ms)
        // as directly calling rpm or dnf is too expensive (~500ms)
        let db = "/var/lib/rpm/rpmdb.sqlite";
        if !Path::new(db).is_file() {
            return None;
        }
        let connection = sqlite::open(db);
        if let Ok(con) = connection {
            let statement = con.prepare("SELECT COUNT(*) FROM Installtid");
            if let Ok(mut s) = statement {
                if s.next().is_ok() {
                    return match s.read::<Option<i64>>(0) {
                        Ok(Some(count)) => Some(count as usize),
                        _ => None,
                    };
                }
            }
        }
        None
    }
fn count_rpm ( ) -> Option < usize > { // Return the number of installed packages using sqlite (~1ms) // as directly calling rpm or dnf is too expensive (~500ms) let db = " " ; if ! Path :: new ( db ) . is_file ( ) { return None ; } let connection = sqlite :: open ( db ) ; if let Ok ( con ) = connection { let statement = con . prepare ( " " ) ; if let Ok ( mut s ) = statement { if s . next ( ) . is_ok ( ) { return match s . read :: < Option < i64 > > ( 0 ) { Ok ( Some ( count ) ) => Some ( count as usize ) , _ => None , } ; } } } None }
Returns the number of installed packages for systems
that utilize `rpm` as their package manager.
Returns the number of installed packages for systems that utilize ` rpm ` as their package manager .