Comment from_str methods

This commit is contained in:
yancy 2024-09-16 11:21:54 -05:00
parent 7360c3ce9a
commit f5cae1cddd
1 changed files with 16 additions and 0 deletions

View File

@ -1157,6 +1157,14 @@ impl ops::DivAssign<u64> for Amount {
impl FromStr for Amount { impl FromStr for Amount {
type Err = ParseError; 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<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let result = Amount::from_str_with_denomination(s); let result = Amount::from_str_with_denomination(s);
@ -1595,6 +1603,14 @@ impl ops::Neg for SignedAmount {
impl FromStr for SignedAmount { impl FromStr for SignedAmount {
type Err = ParseError; 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<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let result = SignedAmount::from_str_with_denomination(s); let result = SignedAmount::from_str_with_denomination(s);