Merge rust-bitcoin/rust-bitcoin#3367: Comment from_str methods

f5cae1cddd Comment from_str methods (yancy)

Pull request description:

  Follow up from https://github.com/rust-bitcoin/rust-bitcoin/pull/3346

ACKs for top commit:
  tcharding:
    ACK f5cae1cddd
  apoelstra:
    ACK f5cae1cddd successfully ran local tests

Tree-SHA512: 2b95381e5281754e2b3a49aa8dfaac5742c244970fb54f68024dc23b61a74955ae95b9a0e7ae848095ac0686df5faf93faf7de3371b2f341b108cc10e5d4a9cd
This commit is contained in:
merge-script 2024-09-18 18:26:38 +00:00
commit 4fb2fccd16
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
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 {
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> {
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<Self, Self::Err> {
let result = SignedAmount::from_str_with_denomination(s);