amount: Fix docs on FromStr

The docs on `FromStr` say "string slice is zero" but actually mean to
document the behaviour when the value represented is zero.

Also the fact that `FromStr` returns an error if parsing fails is self
evident.
This commit is contained in:
Tobin C. Harding 2024-10-31 12:23:50 +11:00
parent 5bec76aa51
commit 3e332c3839
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
2 changed files with 2 additions and 12 deletions

View File

@ -396,12 +396,7 @@ impl FromStr for SignedAmount {
/// 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
///
/// The amount if the string amount and denomination parse successfully,
/// otherwise returns `Err(ParseError)`.
/// If the returned value would be zero or negative zero, then no denomination is required.
fn from_str(s: &str) -> Result<Self, Self::Err> {
let result = SignedAmount::from_str_with_denomination(s);

View File

@ -361,12 +361,7 @@ impl FromStr for Amount {
/// Parses a string slice where the slice includes a denomination.
///
/// If the string slice is zero, then no denomination is required.
///
/// # Returns
///
/// The amount if the string amount and denomination parse successfully,
/// otherwise returns `Err(ParseError)`.
/// If the returned value would be zero or negative zero, then no denomination is required.
fn from_str(s: &str) -> Result<Self, Self::Err> {
let result = Amount::from_str_with_denomination(s);