Skip to content

Commit

Permalink
Merge rust-bitcoin#3875: Change all occurrences of "IO" to "I/O"
Browse files Browse the repository at this point in the history
316d8bc Change all occurrences of "IO" to "I/O" (Jamil Lambert, PhD)

Pull request description:

  Fixes rust-bitcoin#3871

ACKs for top commit:
  tcharding:
    ACK 316d8bc
  apoelstra:
    ACK 316d8bc; successfully ran local tests; lgtm

Tree-SHA512: 437a95a1c36bcd4ae27aaacdfc5e0f3463e522a222c4a6ef2c3e234be4a24be2b600687bd58b300bf2b0a0d6596ab008f60903c91646458228eb34cf510908d6
  • Loading branch information
apoelstra committed Jan 8, 2025
2 parents 72aceb3 + 316d8bc commit 2056abd
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions bitcoin/src/bip158.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand All @@ -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),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion bitcoin/src/consensus/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
Expand Down
4 changes: 2 additions & 2 deletions bitcoin/src/consensus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ impl<E: fmt::Debug, I: Iterator<Item = Result<u8, E>>> IterReader<E, I> {

(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::<T>(), 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::<T>(), 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::<T>(), 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::<T>(), de_error, consensus_error),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions bitcoin/src/consensus/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ impl<E> With<E> {
match (result, writer.error) {
(Ok(_), None) => writer.serializer.end(),
(Ok(_), Some(error)) =>
panic!("{} silently ate an IO error: {:?}", core::any::type_name::<T>(), error),
panic!("{} silently ate an I/O error: {:?}", core::any::type_name::<T>(), 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::<T>(),
io_error,
ser_error
Expand Down
4 changes: 2 additions & 2 deletions bitcoin/src/crypto/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1452,9 +1452,9 @@ impl<E> From<Infallible> for SigningDataError<E> {
}

impl<E> SigningDataError<E> {
/// 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,
Expand Down
2 changes: 1 addition & 1 deletion io/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 7 additions & 7 deletions io/src/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(T);

impl<T> FromStd<T> {
/// 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<T>) -> Box<Self> {
Expand Down Expand Up @@ -121,18 +121,18 @@ impl<T: std::io::Write> std::io::Write for FromStd<T> {
pub struct ToStd<T>(T);

impl<T> ToStd<T> {
/// 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<T>) -> Box<Self> {
Expand Down
6 changes: 3 additions & 3 deletions io/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<T>(std_io: T) -> FromStd<T> { 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")]
Expand Down

0 comments on commit 2056abd

Please sign in to comment.