From 0e5d6db7df9a1f9b4e9180d49cf1532551570e33 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 30 Dec 2024 11:25:19 +1100 Subject: [PATCH] units: Don't ignore serde examples There is no reason to ignore the rustdoc example in `units::amount::serde`. The `as_btc` function requires the `alloc` features so use `as_sat` in the example instead. While we are at it clean up the whole block of rustdocs. --- units/src/amount/serde.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/units/src/amount/serde.rs b/units/src/amount/serde.rs index f022ba159..e7be0fd5d 100644 --- a/units/src/amount/serde.rs +++ b/units/src/amount/serde.rs @@ -3,19 +3,20 @@ // methods are implementation of a standardized serde-specific signature #![allow(missing_docs)] -//! This module adds serde serialization and deserialization support for Amounts. +//! This module adds serde serialization and deserialization support for amounts. //! -//! Since there is not a default way to serialize and deserialize Amounts, multiple -//! ways are supported and it's up to the user to decide which serialiation to use. -//! The provided modules can be used as follows: +//! Since there is not a default way to serialize and deserialize amounts, multiple +//! ways are supported and it's up to the user to decide which serialization to use. //! -//! ```rust,ignore +//! # Examples +//! +//! ``` //! use serde::{Serialize, Deserialize}; //! use bitcoin_units::Amount; //! //! #[derive(Serialize, Deserialize)] //! pub struct HasAmount { -//! #[serde(with = "bitcoin_units::amount::serde::as_btc")] +//! #[serde(with = "bitcoin_units::amount::serde::as_sat")] //! pub amount: Amount, //! } //! ```