pub struct BudgetTracker {
pub epsilon_budget: f64,
pub epsilon_used: f64,
pub delta_budget: f64,
pub delta_used: f64,
pub queries_answered: u64,
}Expand description
Tracks consumed and remaining privacy budget.
Fields§
§epsilon_budget: f64Total epsilon allocated for all queries.
epsilon_used: f64Epsilon consumed so far.
delta_budget: f64Total delta allocated for all queries.
delta_used: f64Delta consumed so far.
queries_answered: u64Number of queries answered successfully.
Implementations§
Source§impl BudgetTracker
impl BudgetTracker
Sourcepub fn new(epsilon_budget: f64, delta_budget: f64) -> Self
pub fn new(epsilon_budget: f64, delta_budget: f64) -> Self
Construct a new tracker with given budgets and zero consumption.
Sourcepub fn remaining_epsilon(&self) -> f64
pub fn remaining_epsilon(&self) -> f64
Remaining epsilon = budget − used.
Sourcepub fn remaining_delta(&self) -> f64
pub fn remaining_delta(&self) -> f64
Remaining delta = budget − used.
Sourcepub fn is_exhausted(&self) -> bool
pub fn is_exhausted(&self) -> bool
Returns true when epsilon_used ≥ epsilon_budget.
Trait Implementations§
Source§impl Clone for BudgetTracker
impl Clone for BudgetTracker
Source§fn clone(&self) -> BudgetTracker
fn clone(&self) -> BudgetTracker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BudgetTracker
impl RefUnwindSafe for BudgetTracker
impl Send for BudgetTracker
impl Sync for BudgetTracker
impl Unpin for BudgetTracker
impl UnsafeUnpin for BudgetTracker
impl UnwindSafe for BudgetTracker
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more