Struct PlatformValidator

Source
pub struct PlatformValidator;
Expand description

Platform compatibility and system requirements validator.

The PlatformValidator provides static methods for checking platform compatibility, validating Ansible installation, and verifying that all required components are available.

§Examples

§Basic Platform Check

use ansible::PlatformValidator;

// Check if current platform is supported
PlatformValidator::check_platform()?;

// Check platform compatibility without panicking
if PlatformValidator::is_platform_supported() {
    println!("Platform is supported");
} else {
    println!("Platform not supported");
}

§Ansible Installation Check

use ansible::PlatformValidator;

// Check if Ansible is installed
match PlatformValidator::check_ansible_installation() {
    Ok(version) => println!("Ansible version: {}", version),
    Err(e) => eprintln!("Ansible not found: {}", e),
}

§Component Availability

use ansible::PlatformValidator;

// Check individual components
let components = [
    ("ansible", PlatformValidator::check_ansible_installation as fn() -> Result<String, _>),
    ("ansible-playbook", PlatformValidator::check_ansible_playbook as fn() -> Result<String, _>),
    ("ansible-vault", PlatformValidator::check_ansible_vault as fn() -> Result<String, _>),
];

for (name, check_fn) in &components {
    match check_fn() {
        Ok(_) => println!("✅ {} is available", name),
        Err(_) => println!("❌ {} is not available", name),
    }
}

Implementations§

Source§

impl PlatformValidator

Source

pub fn check_platform() -> Result<()>

Check if the current platform is supported

Source

pub fn check_ansible_installation() -> Result<String>

Check if Ansible is installed and accessible

Source

pub fn check_ansible_playbook() -> Result<String>

Check if ansible-playbook is available

Source

pub fn check_ansible_vault() -> Result<String>

Check if ansible-vault is available

Source

pub fn check_ansible_config() -> Result<String>

Check if ansible-config is available

Source

pub fn check_ansible_inventory() -> Result<String>

Check if ansible-inventory is available

Source

pub fn check_all_requirements() -> Result<SystemInfo>

Comprehensive system check

Source

pub fn minimum_ansible_version() -> &'static str

Get minimum required Ansible version

Source

pub fn supported_platforms() -> Vec<&'static str>

Get supported platforms

Source

pub fn is_platform_supported() -> bool

Check if current platform is supported

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.