pub struct HirEnergyBudget {
pub max_joules: Option<f64>,
pub max_watts: Option<f64>,
pub max_temp_delta: Option<f64>,
pub compile_time_check: bool,
pub span: Span,
}Expand description
HIR-level energy budget attached to functions.
This is the HIR equivalent of joule_ast::EnergyBudget, extended with
compile-time checking options and resolved during HIR lowering.
§Example
#[energy_budget(max_joules = 0.5, compile_time_check = true)]
fn process(data: &[f32]) -> f32 {
// Compiler will warn if estimated energy exceeds 0.5J
}Fields§
§max_joules: Option<f64>Maximum energy consumption in joules (J)
max_watts: Option<f64>Maximum power consumption in watts (W)
max_temp_delta: Option<f64>Maximum temperature delta in Celsius
compile_time_check: boolWhether to perform compile-time energy checking When true, the compiler will estimate energy and warn/error if exceeded
span: SpanSource span for error reporting
Implementations§
Source§impl HirEnergyBudget
impl HirEnergyBudget
Sourcepub const fn has_constraints(&self) -> bool
pub const fn has_constraints(&self) -> bool
Check if this energy budget has any constraints
Sourcepub const fn has_joule_constraint(&self) -> bool
pub const fn has_joule_constraint(&self) -> bool
Check if the budget has a joule constraint
Sourcepub fn should_check(&self) -> bool
pub fn should_check(&self) -> bool
Check if compile-time checking should be performed
Trait Implementations§
Source§impl Clone for HirEnergyBudget
impl Clone for HirEnergyBudget
Source§fn clone(&self) -> HirEnergyBudget
fn clone(&self) -> HirEnergyBudget
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HirEnergyBudget
impl Debug for HirEnergyBudget
Source§impl Default for HirEnergyBudget
impl Default for HirEnergyBudget
Source§impl PartialEq for HirEnergyBudget
impl PartialEq for HirEnergyBudget
impl StructuralPartialEq for HirEnergyBudget
Auto Trait Implementations§
impl Freeze for HirEnergyBudget
impl RefUnwindSafe for HirEnergyBudget
impl Send for HirEnergyBudget
impl Sync for HirEnergyBudget
impl Unpin for HirEnergyBudget
impl UnwindSafe for HirEnergyBudget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more