diff --git a/bitcoin/src/bip158.rs b/bitcoin/src/bip158.rs index 893376703..419514abf 100644 --- a/bitcoin/src/bip158.rs +++ b/bitcoin/src/bip158.rs @@ -76,7 +76,7 @@ impl_hashencode!(FilterHeader); pub enum Error { /// Missing UTXO, cannot calculate script filter. UtxoMissing(OutPoint), - /// IO error reading or writing binary serialization of the filter. + /// I/O error reading or writing binary serialization of the filter. Io(io::Error), } @@ -90,7 +90,7 @@ impl fmt::Display for Error { match *self { UtxoMissing(ref coin) => write!(f, "unresolved UTXO {}", coin), - Io(ref e) => write_err!(f, "IO error"; e), + Io(ref e) => write_err!(f, "I/O error"; e), } } } diff --git a/bitcoin/src/consensus/error.rs b/bitcoin/src/consensus/error.rs index d10f033e3..d3cbaa846 100644 --- a/bitcoin/src/consensus/error.rs +++ b/bitcoin/src/consensus/error.rs @@ -115,7 +115,7 @@ impl fmt::Display for Error { use Error::*; match *self { - Io(ref e) => write_err!(f, "IO error"; e), + Io(ref e) => write_err!(f, "I/O error"; e), Parse(ref e) => write_err!(f, "error parsing encoded object"; e), } } diff --git a/bitcoin/src/consensus/mod.rs b/bitcoin/src/consensus/mod.rs index 708ff6347..ecf4b6fdb 100644 --- a/bitcoin/src/consensus/mod.rs +++ b/bitcoin/src/consensus/mod.rs @@ -44,8 +44,8 @@ impl>> IterReader { (Err(consensus::encode::Error::Io(io_error)), Some(de_error)) if io_error.kind() == io::ErrorKind::Other && io_error.get_ref().is_none() => Err(DecodeError::Other(de_error)), (Err(consensus::encode::Error::Parse(parse_error)), None) => Err(DecodeError::Parse(parse_error)), - (Err(consensus::encode::Error::Io(io_error)), de_error) => panic!("unexpected IO error {:?} returned from {}::consensus_decode(), deserialization error: {:?}", io_error, core::any::type_name::(), de_error), - (Err(consensus_error), Some(de_error)) => panic!("{} should've returned `Other` IO error because of deserialization error {:?} but it returned consensus error {:?} instead", core::any::type_name::(), de_error, consensus_error), + (Err(consensus::encode::Error::Io(io_error)), de_error) => panic!("unexpected I/O error {:?} returned from {}::consensus_decode(), deserialization error: {:?}", io_error, core::any::type_name::(), de_error), + (Err(consensus_error), Some(de_error)) => panic!("{} should've returned `Other` I/O error because of deserialization error {:?} but it returned consensus error {:?} instead", core::any::type_name::(), de_error, consensus_error), } } } diff --git a/bitcoin/src/consensus/serde.rs b/bitcoin/src/consensus/serde.rs index 8db3989b2..a182e8640 100644 --- a/bitcoin/src/consensus/serde.rs +++ b/bitcoin/src/consensus/serde.rs @@ -443,12 +443,12 @@ impl With { match (result, writer.error) { (Ok(_), None) => writer.serializer.end(), (Ok(_), Some(error)) => - panic!("{} silently ate an IO error: {:?}", core::any::type_name::(), error), + panic!("{} silently ate an I/O error: {:?}", core::any::type_name::(), error), (Err(io_error), Some(ser_error)) if io_error.kind() == io::ErrorKind::Other && io_error.get_ref().is_none() => Err(ser_error), (Err(io_error), ser_error) => panic!( - "{} returned an unexpected IO error: {:?} serialization error: {:?}", + "{} returned an unexpected I/O error: {:?} serialization error: {:?}", core::any::type_name::(), io_error, ser_error diff --git a/bitcoin/src/crypto/sighash.rs b/bitcoin/src/crypto/sighash.rs index 18351e488..6c7a0664d 100644 --- a/bitcoin/src/crypto/sighash.rs +++ b/bitcoin/src/crypto/sighash.rs @@ -1452,9 +1452,9 @@ impl From for SigningDataError { } impl SigningDataError { - /// Returns the sighash variant, panicking if it's IO. + /// Returns the sighash variant, panicking if it's I/O. /// - /// This is used when encoding to hash engine when we know that IO doesn't fail. + /// This is used when encoding to hash engine when we know that I/O doesn't fail. fn unwrap_sighash(self) -> E { match self { Self::Sighash(error) => error, diff --git a/io/README.md b/io/README.md index f276437bc..3d5508de3 100644 --- a/io/README.md +++ b/io/README.md @@ -1,4 +1,4 @@ -# Rust-Bitcoin IO Library +# Rust-Bitcoin I/O Library The `std::io` module is not exposed in `no-std` Rust so building `no-std` applications which require reading and writing objects via standard traits is not generally possible. Thus, this library exists diff --git a/io/src/bridge.rs b/io/src/bridge.rs index 471a6aba0..4079d57fd 100644 --- a/io/src/bridge.rs +++ b/io/src/bridge.rs @@ -3,24 +3,24 @@ use alloc::boxed::Box; use internals::rust_version; -/// A bridging wrapper providing the IO traits for types that already implement `std` IO traits. +/// A bridging wrapper providing the I/O traits for types that already implement `std` I/O traits. #[repr(transparent)] #[derive(Debug)] pub struct FromStd(T); impl FromStd { - /// Wraps an IO type. + /// Wraps an I/O type. #[inline] pub const fn new(inner: T) -> Self { Self(inner) } - /// Wraps a mutable reference to IO type. + /// Wraps a mutable reference to I/O type. #[inline] pub fn new_mut(inner: &mut T) -> &mut Self { // SAFETY: the type is repr(transparent) and the lifetimes match unsafe { &mut *(inner as *mut _ as *mut Self) } } - /// Wraps a boxed IO type. + /// Wraps a boxed I/O type. #[cfg(feature = "alloc")] #[inline] pub fn new_boxed(inner: Box) -> Box { @@ -121,18 +121,18 @@ impl std::io::Write for FromStd { pub struct ToStd(T); impl ToStd { - /// Wraps an IO type. + /// Wraps an I/O type. #[inline] pub const fn new(inner: T) -> Self { Self(inner) } - /// Wraps a mutable reference to IO type. + /// Wraps a mutable reference to I/O type. #[inline] pub fn new_mut(inner: &mut T) -> &mut Self { // SAFETY: the type is repr(transparent) and the lifetimes match unsafe { &mut *(inner as *mut _ as *mut Self) } } - /// Wraps a boxed IO type. + /// Wraps a boxed I/O type. #[cfg(feature = "alloc")] #[inline] pub fn new_boxed(inner: Box) -> Box { diff --git a/io/src/lib.rs b/io/src/lib.rs index c8d846dd5..fcaf1aa39 100644 --- a/io/src/lib.rs +++ b/io/src/lib.rs @@ -1,4 +1,4 @@ -//! Rust-Bitcoin IO Library +//! Rust-Bitcoin I/O Library //! //! The `std::io` module is not exposed in `no-std` Rust so building `no-std` applications which //! require reading and writing objects via standard traits is not generally possible. Thus, this @@ -349,14 +349,14 @@ impl Write for Sink { #[inline] pub fn sink() -> Sink { Sink } -/// Wraps a `std` IO type to implement the traits from this crate. +/// Wraps a `std` I/O type to implement the traits from this crate. /// /// All methods are passed through converting the errors. #[cfg(feature = "std")] #[inline] pub const fn from_std(std_io: T) -> FromStd { FromStd::new(std_io) } -/// Wraps a mutable reference to `std` IO type to implement the traits from this crate. +/// Wraps a mutable reference to `std` I/O type to implement the traits from this crate. /// /// All methods are passed through converting the errors. #[cfg(feature = "std")]