From 9892b663d25103a74fe5bce65255255959786eea Mon Sep 17 00:00:00 2001 From: Maddox Werts Date: Sat, 2 Aug 2025 15:53:27 -0400 Subject: [PATCH] Added documentation to start --- project/src/backend.rs | 17 +++++++++++++++++ project/src/backend/calculator.rs | 12 ++++++++++++ 2 files changed, 29 insertions(+) diff --git a/project/src/backend.rs b/project/src/backend.rs index 99c5352..b64a45b 100644 --- a/project/src/backend.rs +++ b/project/src/backend.rs @@ -54,6 +54,23 @@ impl Backend { pub fn get_memberships(&self) -> Vec { self.memberships.clone() } + /// Calculates the Prorate with the given parameters + /// + /// Memberships need to be in the format of: _"MEMBERSHIPNAME ($PRI.CE)"_ + /// + /// # Arguments + /// * `current_membership` - The text content of what current membership you have + /// * `new_membership` - The text content of what new membership you're getting + /// * `last_billing` - The date of the last time the customer got billed _(mm/dd/yyyy)_ + /// + /// # Examples + /// ```rs + /// let result = calculator.start( + /// "Super ($41.99)".to_string(), + /// "Deluxe ($36.99)".to_string(), + /// "7/16/2025".to_string() + /// )?; + /// ``` pub fn calculator_start( &self, current_membership: String, diff --git a/project/src/backend/calculator.rs b/project/src/backend/calculator.rs index 2e2884a..e4340d5 100644 --- a/project/src/backend/calculator.rs +++ b/project/src/backend/calculator.rs @@ -66,9 +66,21 @@ impl Calculator { // Functions /// Calculates the Prorate with the given parameters /// + /// Memberships need to be in the format of: _"MEMBERSHIPNAME ($PRI.CE)"_ + /// /// # Arguments + /// * `current_membership` - The text content of what current membership you have + /// * `new_membership` - The text content of what new membership you're getting + /// * `last_billing` - The date of the last time the customer got billed _(mm/dd/yyyy)_ /// /// # Examples + /// ```rs + /// let result = calculator.start( + /// "Super ($41.99)".to_string(), + /// "Deluxe ($36.99)".to_string(), + /// "7/16/2025".to_string() + /// )?; + /// ``` pub fn start( &self, current_membership: String,