Skip to content

Commit a547240

Browse files
ClientSocketError implementation
ClientSocketError implementation with further From implementations for IoError
1 parent 8b339a7 commit a547240

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

net/src/socket/client/error.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use std::io::Error;
2+
3+
/// An enum to represent the different errors that can occur for the [crate::socket::client::ClientSocket] instance
4+
pub enum ClientSocketError{
5+
/// Indicates that the error caused is due to I/O operations by tcp_listner and other I/O object
6+
IoError{
7+
/// The underlying I/O Error
8+
source:Error
9+
}
10+
}
11+
12+
/// From implementation to typecast [std::io::Error] to [ClientSocketError]
13+
impl From<Error> for ClientSocketError{
14+
fn from(value: Error) -> Self {
15+
ClientSocketError::IoError { source: value }
16+
}
17+
}

0 commit comments

Comments
 (0)