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: ACKf5cae1cddd
apoelstra: ACKf5cae1cddd
successfully ran local tests Tree-SHA512: 2b95381e5281754e2b3a49aa8dfaac5742c244970fb54f68024dc23b61a74955ae95b9a0e7ae848095ac0686df5faf93faf7de3371b2f341b108cc10e5d4a9cd
This commit is contained in:
commit
4fb2fccd16
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue