Commit Graph

7 Commits

Author SHA1 Message Date
Tobin C. Harding 71fab82a1b
io: Improve docs on macro
Note that the docsrs build enables all features so the `impl_write`
macro gets a `std` feature flag even though it is available without the
`std` feature enabled. I can't think of a solution to that slight
annoyance ATM.

The current docs on `impl_write` seem to be stale. The macro just does a
simple call through implementation of `crate::Write` and the same for
`std::io::Write` if `std` is enabled.

Improve the rusdocs by doing:

- Remove module level docs because this is a private module and they
  only add minimal value.
- Put the docs on the `std` macro only (docs build uses --all-features)
- Explain just what the macro does and include an `# Arguments` section.
2025-01-11 09:23:02 +11:00
Tobin C. Harding 9c81d5e747
io: Move macro_export below docs
The `io::macros` crate uses a kind of nifty trick of putting
`macro_export` _above_ the docs. But we do not do this anywhere else in
the code base so its a bit surprising. We should be uniform.

Simply because its an easier change move the `macro_export` attribute to
be under the docs.

Internal change only.
2025-01-11 09:23:01 +11:00
Tobin C. Harding 07d8703a00
io: Add SPDX identifier
The `io` crate is licensed in the manifest using the CC0-1.0 license
same as the rest of the codebase but none of the individual files have a
license blurb.

Add a CC0-1.0 license blurb by way of an SPDX-License-Identifier tag.
2025-01-11 09:20:52 +11:00
Tobin C. Harding b844637935
io: Remove rustdoc for private module
This doc adds little value and has typos in it - just remove it.
2025-01-11 09:20:21 +11:00
Tobin C. Harding db888fa4cc
io: Remove blanket trait impls
Remove the blanket impls of `Read`, `BufRead`, and `Write`. Replace them
with a set of sane impls.

Note, we add code to the `impl_write` macro to implement both
`crate::Write` and `std::io::Write` when "std" feature is
enabled.

Fix: #2432
2024-02-11 06:46:27 +11:00
Tobin C. Harding 5c0759a390
Inline io module in io crate root
Its not immediately obvious why we nest the whole `io` code in an `io`
submodule within `lib.rs`. As far as I can tell we can inline it and
re-export from `rust-bitcoin` same as we do for our other dependencies.

This change would effect other users of the crate but since the `io`
crate is unreleased this effects no-one except us.
2023-11-28 14:17:14 +11:00
Tobin C. Harding 80fe9b99b2
Move public macros to a separate module
In preparation for inlining the `io` molule, move the public macros to a
private `macros` module.

Includes removal of the public re-export of `std` as `_std` - flaggin
this because I do not understand why it is here in the first place, we
can use `std::io::Write` in code that is feature gated on "std".
2023-11-28 11:43:35 +11:00