pub struct CustomerEngagement {
pub total_orders: u32,
pub orders_last_12_months: u32,
pub lifetime_revenue: Decimal,
pub revenue_last_12_months: Decimal,
pub average_order_value: Decimal,
pub days_since_last_order: u32,
pub last_order_date: Option<NaiveDate>,
pub first_order_date: Option<NaiveDate>,
pub products_purchased: u32,
pub support_tickets: u32,
pub nps_score: Option<i8>,
}Expand description
Customer engagement metrics.
Fields§
§total_orders: u32Total orders placed
orders_last_12_months: u32Orders in the last 12 months
lifetime_revenue: DecimalTotal revenue (lifetime)
revenue_last_12_months: DecimalRevenue in the last 12 months
average_order_value: DecimalAverage order value
days_since_last_order: u32Days since last order
last_order_date: Option<NaiveDate>Last order date
first_order_date: Option<NaiveDate>First order date
products_purchased: u32Number of products purchased
support_tickets: u32Support tickets created
nps_score: Option<i8>Net promoter score (if available)
Implementations§
Source§impl CustomerEngagement
impl CustomerEngagement
Sourcepub fn record_order(
&mut self,
amount: Decimal,
order_date: NaiveDate,
product_count: u32,
)
pub fn record_order( &mut self, amount: Decimal, order_date: NaiveDate, product_count: u32, )
Record an order.
Sourcepub fn update_days_since_last_order(&mut self, current_date: NaiveDate)
pub fn update_days_since_last_order(&mut self, current_date: NaiveDate)
Update days since last order (call periodically).
Sourcepub fn health_score(&self) -> f64
pub fn health_score(&self) -> f64
Calculate customer health score (0.0 to 1.0).
Trait Implementations§
Source§impl Clone for CustomerEngagement
impl Clone for CustomerEngagement
Source§fn clone(&self) -> CustomerEngagement
fn clone(&self) -> CustomerEngagement
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 moreSource§impl Debug for CustomerEngagement
impl Debug for CustomerEngagement
Source§impl Default for CustomerEngagement
impl Default for CustomerEngagement
Source§impl<'de> Deserialize<'de> for CustomerEngagement
impl<'de> Deserialize<'de> for CustomerEngagement
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
Auto Trait Implementations§
impl Freeze for CustomerEngagement
impl RefUnwindSafe for CustomerEngagement
impl Send for CustomerEngagement
impl Sync for CustomerEngagement
impl Unpin for CustomerEngagement
impl UnsafeUnpin for CustomerEngagement
impl UnwindSafe for CustomerEngagement
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> 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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.