Skip to content

Commit

Permalink
Rename NetworkError into Network
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesFoundation committed Nov 20, 2024
1 parent 621f7dc commit 34bf181
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 3 additions & 7 deletions stratum-v1/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,12 @@ impl<C: Read + ReadReady + Write, const RX_BUF_SIZE: usize, const TX_BUF_SIZE: u
self.rx_buf.copy_within(start..self.rx_free_pos, 0);
self.rx_free_pos -= start;
}
if self
.network_conn
.read_ready()
.map_err(|_| Error::NetworkError)?
{
if self.network_conn.read_ready().map_err(|_| Error::Network)? {
let n = self
.network_conn
.read(self.rx_buf[self.rx_free_pos..].as_mut())
.await
.map_err(|_| Error::NetworkError)?;
.map_err(|_| Error::Network)?;
debug!("read {} bytes @{}", n, self.rx_free_pos);
trace!("{:?}", &self.rx_buf[self.rx_free_pos..self.rx_free_pos + n]);
self.rx_free_pos += n;
Expand All @@ -220,7 +216,7 @@ impl<C: Read + ReadReady + Write, const RX_BUF_SIZE: usize, const TX_BUF_SIZE: u
self.network_conn
.write_all(&self.tx_buf[..req_len + 1])
.await
.map_err(|_| Error::NetworkError)
.map_err(|_| Error::Network)
}

/// # Configure Client
Expand Down
8 changes: 4 additions & 4 deletions stratum-v1/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ pub enum Error {

/// Network error
// #[from]
// NetworkError(embedded_io::ErrorKind),
NetworkError,
// Network(embedded_io::ErrorKind),
Network,

IdNotFound(u64),

Expand All @@ -74,10 +74,10 @@ pub enum Error {
}

#[cfg(feature = "core-error")]
impl<E: core::fmt::Debug> core::error::Error for Error<E> {}
impl core::error::Error for Error {}

#[cfg(feature = "core-error")]
impl<E: core::fmt::Debug> core::fmt::Display for Error<E> {
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{self:?}")
}
Expand Down

0 comments on commit 34bf181

Please sign in to comment.