diff --git a/io/src/lib.rs b/io/src/lib.rs index 8da2d108d..f92ec11f3 100644 --- a/io/src/lib.rs +++ b/io/src/lib.rs @@ -9,6 +9,9 @@ //! //! These traits are not one-for-one drop-ins, but are as close as possible while still implementing //! `std::io`'s traits without unnecessary complexity. +//! +//! For examples of how to use and implement the types and traits in this crate see `io.rs` in the +//! `github.com/rust-bitcoin/rust-bitcoin/bitcoin/examples/` directory. #![cfg_attr(not(feature = "std"), no_std)] // Experimental features we need. @@ -31,7 +34,6 @@ pub extern crate hashes; #[cfg(feature = "std")] mod bridge; mod error; -mod macros; #[cfg(feature = "hashes")] mod hash; diff --git a/io/src/macros.rs b/io/src/macros.rs deleted file mode 100644 index 55df18aa7..000000000 --- a/io/src/macros.rs +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: CC0-1.0 - -/// Implements [`crate::Write`] for `$ty`. -// See below for docs (docs.rs build enables all features). -#[cfg(not(feature = "std"))] -#[macro_export] -macro_rules! impl_write { - ($ty: ty, $write_fn: expr, $flush_fn: expr $(, $bounded_ty: ident : $bounds: path),*) => { - impl<$($bounded_ty: $bounds),*> $crate::Write for $ty { - #[inline] - fn write(&mut self, buf: &[u8]) -> $crate::Result { - $write_fn(self, buf) - } - #[inline] - fn flush(&mut self) -> $crate::Result<()> { - $flush_fn(self) - } - } - } -} - -/// Implements [`crate::Write`] for `$ty`. -/// -/// Also implements [`std::io::Write`] for `$ty` if `bitcoin_io` has the `std` feature enabled. -/// -/// # Arguments -/// -/// * `$ty` - the type used to implement the two traits. -/// * `write_fn` - the function called by the `Write::write` trait method. -/// * `flush_fn` - the function called by the `Write::flush` trait method. -/// * `$bounded_ty: $bounds` - optional trait bounds if required. -#[cfg(feature = "std")] -#[macro_export] -macro_rules! impl_write { - ($ty: ty, $write_fn: expr, $flush_fn: expr $(, $bounded_ty: ident : $bounds: path),*) => { - impl<$($bounded_ty: $bounds),*> std::io::Write for $ty { - #[inline] - fn write(&mut self, buf: &[u8]) -> std::io::Result { - $write_fn(self, buf) - } - #[inline] - fn flush(&mut self) -> std::io::Result<()> { - $flush_fn(self) - } - } - - impl<$($bounded_ty: $bounds),*> $crate::Write for $ty { - #[inline] - fn write(&mut self, buf: &[u8]) -> $crate::Result { - $write_fn(self, buf) - } - #[inline] - fn flush(&mut self) -> $crate::Result<()> { - $flush_fn(self) - } - } - } -}