Skip to main content

SafetyNetBudget

Struct SafetyNetBudget 

Source
pub struct SafetyNetBudget {
    pub max_scan_time_us: u64,
    pub max_scan_candidates: u64,
    pub max_distance_ops: u64,
}
Expand description

Budget caps for the brute-force safety net.

All three are enforced simultaneously. The scan stops at whichever hits first. These are runtime limits, not caller-adjustable above the defaults (unless QualityPreference::PreferQuality, which extends to 4x).

Fields§

§max_scan_time_us: u64

Maximum wall-clock time for the safety net scan (microseconds).

§max_scan_candidates: u64

Maximum number of candidate vectors to scan.

§max_distance_ops: u64

Maximum number of distance evaluations.

Implementations§

Source§

impl SafetyNetBudget

Source

pub const LAYER_A: Self

Layer A only defaults: tight budget for instant first query.

Source

pub const PARTIAL: Self

Partial index defaults: moderate budget.

Source

pub const FULL: Self

Full index: generous budget.

Source

pub const DISABLED: Self

Disabled: all zeros. Safety net will not scan anything.

Source

pub const fn extended_4x(&self) -> Self

Extend all budgets by 4x for PreferQuality mode. Uses saturating arithmetic to prevent overflow.

Source

pub const fn is_disabled(&self) -> bool

Check if all budgets are zero (disabled).

Trait Implementations§

Source§

impl Clone for SafetyNetBudget

Source§

fn clone(&self) -> SafetyNetBudget

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SafetyNetBudget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SafetyNetBudget

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for SafetyNetBudget

Source§

fn eq(&self, other: &SafetyNetBudget) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SafetyNetBudget

Source§

impl Eq for SafetyNetBudget

Source§

impl StructuralPartialEq for SafetyNetBudget

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.