pub struct CtrStats {
pub item_id: String,
pub impressions: u64,
pub clicks: u64,
}Expand description
Raw impression/click counts and derived metrics for a single item.
Fields§
§item_id: StringThe item identifier (e.g. thumbnail slug or content ID).
impressions: u64Total number of times this item was shown to viewers.
clicks: u64Total number of times viewers clicked/tapped this item.
Implementations§
Source§impl CtrStats
impl CtrStats
Sourcepub fn ctr(&self) -> f64
pub fn ctr(&self) -> f64
Computes the raw click-through rate: clicks / impressions.
Returns 0.0 when impressions == 0.
Sourcepub fn wilson_interval(&self, z: f64) -> (f64, f64)
pub fn wilson_interval(&self, z: f64) -> (f64, f64)
Computes the Wilson score confidence interval for the CTR.
Returns (lower, upper) bounds at the given z level. Common values:
z = 1.645→ 90 % confidencez = 1.960→ 95 % confidence (default)z = 2.576→ 99 % confidence
Returns (0.0, 0.0) when impressions == 0.
§Reference
Wilson, E. B. (1927). Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association, 22(158), 209-212.
Sourcepub fn is_untracked(&self) -> bool
pub fn is_untracked(&self) -> bool
Returns true when this item has never been shown.
Trait Implementations§
impl StructuralPartialEq for CtrStats
Auto Trait Implementations§
impl Freeze for CtrStats
impl RefUnwindSafe for CtrStats
impl Send for CtrStats
impl Sync for CtrStats
impl Unpin for CtrStats
impl UnsafeUnpin for CtrStats
impl UnwindSafe for CtrStats
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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