use core::time::Duration;
use super::error::Function;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Warmed {
function: Option<Function>,
load: Duration,
first_prediction: Duration,
}
impl Warmed {
#[inline]
pub(crate) const fn new(function: Option<Function>, load: Duration, first: Duration) -> Self {
Self {
function,
load,
first_prediction: first,
}
}
#[inline]
pub const fn function(&self) -> Option<Function> {
self.function
}
#[inline]
pub const fn load(&self) -> Duration {
self.load
}
#[inline]
pub const fn first_prediction(&self) -> Duration {
self.first_prediction
}
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct PrewarmReport {
warmed: Vec<Warmed>,
}
impl PrewarmReport {
#[inline]
pub fn warmed(&self) -> &[Warmed] {
&self.warmed
}
#[inline]
pub(crate) fn push(&mut self, warmed: Warmed) {
self.warmed.push(warmed);
}
#[inline]
pub(crate) fn extend(&mut self, other: Self) {
self.warmed.extend(other.warmed);
}
}