Clean up possibly confusing
Put the list of possibly confusing forms in the same order as the enum and fix the rustdocs to show the actual error variants returned.
This commit is contained in:
parent
aeca93b561
commit
60f2089dcd
|
@ -126,7 +126,7 @@ impl Denomination {
|
||||||
|
|
||||||
/// These form are ambigous and could have many meanings. For example, M could denote Mega or Milli.
|
/// These form are ambigous and could have many meanings. For example, M could denote Mega or Milli.
|
||||||
/// If any of these forms are used, an error type PossiblyConfusingDenomination is returned.
|
/// If any of these forms are used, an error type PossiblyConfusingDenomination is returned.
|
||||||
const CONFUSING_FORMS: [&str; 6] = ["MBTC", "Mbtc", "CBTC", "Cbtc", "UBTC", "Ubtc"];
|
const CONFUSING_FORMS: [&str; 6] = ["CBTC", "Cbtc", "MBTC", "Mbtc", "UBTC", "Ubtc"];
|
||||||
|
|
||||||
impl fmt::Display for Denomination {
|
impl fmt::Display for Denomination {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_str()) }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_str()) }
|
||||||
|
@ -139,10 +139,9 @@ impl FromStr for Denomination {
|
||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// - If the denomination begins with a capital `M` a [`PossiblyConfusingDenominationError`] is
|
/// - [`ParseDenominationError::PossiblyConfusing`]: If the denomination begins with a capital
|
||||||
/// returned.
|
/// letter that could be confused with centi, milli, or micro-bitcoin.
|
||||||
///
|
/// - [`ParseDenominationError::Unknown`]: If an unknown denomination is used.
|
||||||
/// - If an unknown denomination is used, an [`UnknownDenominationError`] is returned.
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
use self::ParseDenominationError::*;
|
use self::ParseDenominationError::*;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue