mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-27 00:31:35 +00:00
Add an Error associated type to transports (#835)
* Add an Error associated type to transports * Improve raw swarm a bit * Rename map_other to map * Use source() instead of cause() * RawSwarmIncErr -> IncomingError
This commit is contained in:
@ -30,15 +30,6 @@ pub enum UpgradeError<E> {
|
||||
Apply(E),
|
||||
}
|
||||
|
||||
impl<E> UpgradeError<E>
|
||||
where
|
||||
E: std::error::Error + Send + Sync + 'static
|
||||
{
|
||||
pub fn into_io_error(self) -> std::io::Error {
|
||||
std::io::Error::new(std::io::ErrorKind::Other, self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E> UpgradeError<E> {
|
||||
pub fn map_err<F, T>(self, f: F) -> UpgradeError<T>
|
||||
where
|
||||
@ -72,9 +63,9 @@ where
|
||||
|
||||
impl<E> std::error::Error for UpgradeError<E>
|
||||
where
|
||||
E: std::error::Error
|
||||
E: std::error::Error + 'static
|
||||
{
|
||||
fn cause(&self) -> Option<&dyn std::error::Error> {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match self {
|
||||
UpgradeError::Select(e) => Some(e),
|
||||
UpgradeError::Apply(e) => Some(e),
|
||||
|
Reference in New Issue
Block a user