Trait libmacchina::traits::PackageReadout[][src]

pub trait PackageReadout {
    fn new() -> Self;

    fn count_pkgs(&self) -> Vec<(PackageManager, usize)> { ... }
}
Expand description

This trait provides the interface for implementing functionality used for counting packages on the host system. Almost all modern operating systems use some kind of package manager.

Example

use libmacchina::traits::{PackageReadout, PackageManager};
use libmacchina::traits::ReadoutError;

pub struct MacOSPackageReadout;

impl PackageReadout for MacOSPackageReadout {
    fn new() -> Self {
        MacOSPackageReadout {}
    }

    fn count_pkgs(&self) -> Vec<(PackageManager, usize)> {
        // Check if homebrew 🍻 is installed and count installed packages...
        vec![(PackageManager::Homebrew, 120)]
    }
}

Required methods

fn new() -> Self[src]

Expand description

Creates a new instance of the structure which implements this trait.

Provided methods

fn count_pkgs(&self) -> Vec<(PackageManager, usize)>[src]

Expand description

This function should return the number of installed packages.

Implementors