• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kaidokert / winc-rs / 15882839692

25 Jun 2025 05:17PM UTC coverage: 85.513% (-0.5%) from 85.995%
15882839692

Pull #88

github

kaidokert
logging cleanup
Pull Request #88: Add USB-serial logging

0 of 29 new or added lines in 1 file covered. (0.0%)

19 existing lines in 1 file now uncovered.

4421 of 5170 relevant lines covered (85.51%)

37629.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/winc-rs/src/stack/stack_error.rs
1
use crate::manager::WifiConnError;
2

3
use crate::manager::SocketError;
4

5
use embedded_nal::nb;
6

7
/// Stack errors
8
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9
#[derive(Debug, PartialEq)]
10
pub enum StackError {
11
    WouldBlock,
12
    GeneralTimeout,
13
    /// TCP connection timed out
14
    ConnectTimeout,
15
    RecvTimeout,
16
    SendTimeout,
17
    OutOfSockets,
18
    SocketAlreadyInUse,
19
    CloseFailed,
20
    Unexpected,
21
    DispatchError(crate::errors::Error),
22
    ConnectSendFailed(crate::errors::Error),
23
    ReceiveFailed(crate::errors::Error),
24
    SendSendFailed(crate::errors::Error),
25
    SendCloseFailed(crate::errors::Error),
26
    BindFailed(crate::errors::Error),
27
    WincWifiFail(crate::errors::Error),
28
    OpFailed(SocketError),
29
    /// DNS lookup timed out
30
    DnsTimeout,
31
    /// Unexpected DNS error
32
    DnsFailed,
33
    /// Operation was attempted in wrong state
34
    InvalidState,
35
    AlreadyConnected,
36
    /// Acess point join failed
37
    ApJoinFailed(WifiConnError),
38
    /// Scan operation failed
39
    ApScanFailed(WifiConnError),
40
    // Continue
41
    ContinueOperation,
42
    /// Not found
43
    SocketNotFound,
44
    /// Parameters are not valid.
45
    InvalidParameters,
46
}
47

48
impl From<core::convert::Infallible> for StackError {
49
    fn from(_: core::convert::Infallible) -> Self {
×
50
        unreachable!()
×
51
    }
52
}
53

54
impl From<SocketError> for StackError {
55
    fn from(inner: SocketError) -> Self {
×
56
        Self::OpFailed(inner)
×
57
    }
×
58
}
59

60
impl From<crate::errors::Error> for StackError {
61
    fn from(inner: crate::errors::Error) -> Self {
×
62
        Self::WincWifiFail(inner)
×
63
    }
×
64
}
65

66
impl embedded_nal::TcpError for StackError {
67
    fn kind(&self) -> embedded_nal::TcpErrorKind {
×
68
        embedded_nal::TcpErrorKind::Other
×
69
    }
×
70
}
71

72
impl From<nb::Error<StackError>> for StackError {
73
    fn from(inner: nb::Error<StackError>) -> Self {
×
74
        match inner {
×
75
            nb::Error::WouldBlock => StackError::WouldBlock,
×
76
            nb::Error::Other(e) => e,
×
77
        }
78
    }
×
79
}
80

81
impl core::fmt::Display for StackError {
NEW
82
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
×
NEW
83
        match self {
×
NEW
84
            StackError::WouldBlock => write!(f, "Operation would block"),
×
NEW
85
            StackError::GeneralTimeout => write!(f, "General timeout"),
×
NEW
86
            StackError::ConnectTimeout => write!(f, "TCP connection timed out"),
×
NEW
87
            StackError::RecvTimeout => write!(f, "Receive timeout"),
×
NEW
88
            StackError::SendTimeout => write!(f, "Send timeout"),
×
NEW
89
            StackError::OutOfSockets => write!(f, "Out of sockets"),
×
NEW
90
            StackError::SocketAlreadyInUse => write!(f, "Socket already in use"),
×
NEW
91
            StackError::CloseFailed => write!(f, "Close failed"),
×
NEW
92
            StackError::Unexpected => write!(f, "Unexpected error"),
×
NEW
93
            StackError::DispatchError(_) => write!(f, "Dispatch error"),
×
NEW
94
            StackError::ConnectSendFailed(_) => write!(f, "Connect send failed"),
×
NEW
95
            StackError::ReceiveFailed(_) => write!(f, "Receive failed"),
×
NEW
96
            StackError::SendSendFailed(_) => write!(f, "Send send failed"),
×
NEW
97
            StackError::SendCloseFailed(_) => write!(f, "Send close failed"),
×
NEW
98
            StackError::BindFailed(_) => write!(f, "Bind failed"),
×
NEW
99
            StackError::WincWifiFail(_) => write!(f, "WincWifi fail"),
×
NEW
100
            StackError::OpFailed(_) => write!(f, "Operation failed"),
×
NEW
101
            StackError::DnsTimeout => write!(f, "DNS lookup timed out"),
×
NEW
102
            StackError::DnsFailed => write!(f, "DNS lookup failed"),
×
NEW
103
            StackError::InvalidState => write!(f, "Invalid state"),
×
NEW
104
            StackError::AlreadyConnected => write!(f, "Already connected"),
×
NEW
105
            StackError::ApJoinFailed(_) => write!(f, "Access point join failed"),
×
NEW
106
            StackError::ApScanFailed(_) => write!(f, "Access point scan failed"),
×
NEW
107
            StackError::ContinueOperation => write!(f, "Continue operation"),
×
NEW
108
            StackError::SocketNotFound => write!(f, "Socket not found"),
×
NEW
109
            StackError::InvalidParameters => write!(f, "Invalid parameters"),
×
110
        }
NEW
111
    }
×
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc