From 2ca24f00f2161d6d618df2ee55d29c44ccce9359 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 22 Jan 2025 13:12:40 +0000 Subject: [PATCH 1/3] =?UTF-8?q?Add=20`=C2=B5BTC`=20as=20a=20recognized=20`?= =?UTF-8?q?str`=20form=20of=20`uBTC`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `µ` is the correct letter for the SI unit micro but is not on most standard keyboards. `u` was used instead because it looks similar. Add `µBTC` to the list of recognized strings for MicroBitcoin and to the rustdocs. --- units/src/amount/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/units/src/amount/mod.rs b/units/src/amount/mod.rs index 8e3a92515..732f1cc10 100644 --- a/units/src/amount/mod.rs +++ b/units/src/amount/mod.rs @@ -42,7 +42,7 @@ pub use self::{ /// /// # Accepted Denominations /// -/// All upper or lower case, excluding SI prefix (c, m, u) which must be lower case. +/// All upper or lower case, excluding SI prefixes c, m and u (or µ) which must be lower case. /// - Singular: BTC, cBTC, mBTC, uBTC /// - Plural or singular: sat, satoshi, bit /// @@ -119,7 +119,7 @@ impl Denomination { "BTC" | "btc" => Some(Denomination::Bitcoin), "cBTC" | "cbtc" => Some(Denomination::CentiBitcoin), "mBTC" | "mbtc" => Some(Denomination::MilliBitcoin), - "uBTC" | "ubtc" => Some(Denomination::MicroBitcoin), + "uBTC" | "ubtc" | "µBTC" | "µbtc" => Some(Denomination::MicroBitcoin), "bit" | "bits" | "BIT" | "BITS" => Some(Denomination::Bit), "SATOSHI" | "satoshi" | "SATOSHIS" | "satoshis" | "SAT" | "sat" | "SATS" | "sats" => Some(Denomination::Satoshi), From afba28e188c6c44e0ddd3169843be7bbc06b2f7e Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 22 Jan 2025 13:26:03 +0000 Subject: [PATCH 2/3] =?UTF-8?q?Change=20`uBTC`=20to=20`=C2=B5BTC`=20in=20r?= =?UTF-8?q?ustdocs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clippy thinks `µBTC` in the docs needs backticks. Allow it without backticks. --- units/src/amount/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/units/src/amount/mod.rs b/units/src/amount/mod.rs index 732f1cc10..1980a8c54 100644 --- a/units/src/amount/mod.rs +++ b/units/src/amount/mod.rs @@ -67,6 +67,7 @@ pub use self::{ /// ``` #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[non_exhaustive] +#[allow(clippy::doc_markdown)] pub enum Denomination { /// BTC (1 BTC = 100,000,000 satoshi). Bitcoin, @@ -74,9 +75,9 @@ pub enum Denomination { CentiBitcoin, /// mBTC (1 mBTC = 100,000 satoshi). MilliBitcoin, - /// uBTC (1 uBTC = 100 satoshi). + /// µBTC (1 µBTC = 100 satoshi). MicroBitcoin, - /// bits (bits = uBTC). + /// bits (bits = µBTC). Bit, /// satoshi (1 BTC = 100,000,000 satoshi). Satoshi, From 4dcdf73cfa896b2c095cda9064c6e0a0e9aeec2b Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Wed, 22 Jan 2025 13:26:36 +0000 Subject: [PATCH 3/3] =?UTF-8?q?Add=20`=C2=B5BTC`=20and=20`=C2=B5btc`=20to?= =?UTF-8?q?=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- units/src/amount/tests.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/units/src/amount/tests.rs b/units/src/amount/tests.rs index 42a9e3d3c..192b1552b 100644 --- a/units/src/amount/tests.rs +++ b/units/src/amount/tests.rs @@ -1013,8 +1013,9 @@ fn checked_sum_amounts() { fn denomination_string_acceptable_forms() { // Exhaustive list of valid forms. let valid = [ - "BTC", "btc", "cBTC", "cbtc", "mBTC", "mbtc", "uBTC", "ubtc", "bit", "bits", "BIT", "BITS", - "SATOSHI", "satoshi", "SATOSHIS", "satoshis", "SAT", "sat", "SATS", "sats", + "BTC", "btc", "cBTC", "cbtc", "mBTC", "mbtc", "uBTC", "ubtc", "µBTC", "µbtc", "bit", + "bits", "BIT", "BITS", "SATOSHI", "satoshi", "SATOSHIS", "satoshis", "SAT", "sat", "SATS", + "sats", ]; for denom in valid { assert!(denom.parse::().is_ok());