joularcore 0.1.0

Joular Core is a platform to measure power and energy across all systems, OSes and devices
Documentation
/*
 * Copyright (c) 2025-2026, Adel Noureddine.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the
 * GNU Lesser General Public License v3.0 only (LGPL-3.0-only)
 * which accompanies this distribution, and is available at
 * https://www.gnu.org/licenses/lgpl-3.0.en.html
 *
 * Author : Adel Noureddine
 */

#[cfg(all(target_os = "linux", not(feature = "sbc")))]
pub mod linux;

#[cfg(target_os = "windows")]
pub mod windows;

#[cfg(target_os = "macos")]
pub mod macos;

#[cfg(all(target_os = "linux", feature = "sbc"))]
pub mod sbc;

#[cfg(any(target_os = "windows", all(target_os = "linux", not(feature = "sbc"))))]
pub mod nvidia;

#[cfg(any(target_os = "windows", all(target_os = "linux", not(feature = "sbc"))))]
pub mod amdgpu;

use crate::energy::PlatformEnergy;

#[cfg(all(target_os = "linux", feature = "sbc"))]
pub fn current(_allow_elevation: bool) -> Box<dyn PlatformEnergy> {
    Box::new(sbc::SBCPlatform::new())
}

#[cfg(all(target_os = "linux", not(feature = "sbc")))]
pub fn current(_allow_elevation: bool) -> Box<dyn PlatformEnergy> {
    Box::new(linux::LinuxPlatform::new())
}

#[cfg(target_os = "windows")]
pub fn current(_allow_elevation: bool) -> Box<dyn PlatformEnergy> {
    Box::new(windows::WindowsPlatform::new())
}

#[cfg(target_os = "macos")]
pub fn current(allow_elevation: bool) -> Box<dyn PlatformEnergy> {
    Box::new(macos::MacOSPlatform::new(allow_elevation))
}