pub struct Guardrail {
pub alpha: f64,
pub delta: f64,
pub window: usize,
pub min_n: usize,
pub action: GuardrailAction,
}Expand description
Guardrail settings.
Fields§
§alpha: f64The served-failure target being defended, in (0, 1).
delta: f64Confidence parameter for the bound, in (0, 1). Matches the delta used to earn the
published guarantee, so the guardrail defends the same number that was advertised.
window: usizeTrailing window of resolved outcomes to judge over.
min_n: usizeNever act on fewer resolved samples than this.
action: GuardrailActionWhat to do on breach.
Implementations§
Source§impl Guardrail
impl Guardrail
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Whether this configuration is coherent.
§Errors
If alpha/delta are outside (0, 1), the window is zero, or min_n exceeds the window
(which would make the guardrail unable to ever act — a silently inert guard is worse than
none, because an operator believes they are protected).
Trait Implementations§
impl Copy for Guardrail
Source§impl<'de> Deserialize<'de> for Guardrail
impl<'de> Deserialize<'de> for Guardrail
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Guardrail
Auto Trait Implementations§
impl Freeze for Guardrail
impl RefUnwindSafe for Guardrail
impl Send for Guardrail
impl Sync for Guardrail
impl Unpin for Guardrail
impl UnsafeUnpin for Guardrail
impl UnwindSafe for Guardrail
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