From f5cae1cddd5b0cec648cbb7d46324eeb0040459d Mon Sep 17 00:00:00 2001 From: yancy Date: Mon, 16 Sep 2024 11:21:54 -0500 Subject: [PATCH] Comment from_str methods --- units/src/amount.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/units/src/amount.rs b/units/src/amount.rs index a305a5030..d97877b0d 100644 --- a/units/src/amount.rs +++ b/units/src/amount.rs @@ -1157,6 +1157,14 @@ impl ops::DivAssign for Amount { impl FromStr for Amount { type Err = ParseError; + /// Parses a string slice where the slice includes a denomination. + /// + /// If the string slice is zero, then no denomination is required. + /// + /// # Returns + /// + /// `Ok(Amount)` if the string amount and denomination parse successfully, + /// otherwise, return `Err(ParseError)`. fn from_str(s: &str) -> Result { let result = Amount::from_str_with_denomination(s); @@ -1595,6 +1603,14 @@ impl ops::Neg for SignedAmount { impl FromStr for SignedAmount { type Err = ParseError; + /// Parses a string slice where the slice includes a denomination. + /// + /// If the string slice is zero or negative zero, then no denomination is required. + /// + /// # Returns + /// + /// `Ok(Amount)` if the string amount and denomination parse successfully, + /// otherwise, return `Err(ParseError)`. fn from_str(s: &str) -> Result { let result = SignedAmount::from_str_with_denomination(s);