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

kaidokert / winc-rs / 18783924770

24 Oct 2025 03:09PM UTC coverage: 83.85% (-0.05%) from 83.901%
18783924770

push

github

web-flow
Add support for SSL operations (#114)

* Added support for SSL apis.

* Added feature flag for SSL and updated ECC functions.

* Updated SSL and ECC apis.

* Fixed Socket socket send and code clean-up.

67 of 74 new or added lines in 9 files covered. (90.54%)

4 existing lines in 3 files now uncovered.

4413 of 5263 relevant lines covered (83.85%)

36719.49 hits per line

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

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

3
#[cfg(feature = "experimental-ota")]
4
use crate::manager::OtaUpdateError;
5
use crate::manager::SocketError;
6

7
use embedded_nal::nb;
8

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

55
impl From<core::convert::Infallible> for StackError {
56
    fn from(_: core::convert::Infallible) -> Self {
×
57
        unreachable!()
×
58
    }
59
}
60

61
impl From<SocketError> for StackError {
62
    fn from(inner: SocketError) -> Self {
×
63
        Self::OpFailed(inner)
×
64
    }
×
65
}
66

67
impl From<crate::errors::CommError> for StackError {
68
    fn from(inner: crate::errors::CommError) -> Self {
×
69
        Self::WincWifiFail(inner)
×
70
    }
×
71
}
72

73
impl From<crate::errors::CommError> for nb::Error<StackError> {
74
    fn from(inner: crate::errors::CommError) -> Self {
1✔
75
        nb::Error::Other(StackError::WincWifiFail(inner))
1✔
76
    }
1✔
77
}
78

79
impl From<core::net::AddrParseError> for StackError {
80
    fn from(_: core::net::AddrParseError) -> Self {
×
81
        Self::InvalidParameters
×
82
    }
×
83
}
84

85
impl embedded_nal::TcpError for StackError {
86
    fn kind(&self) -> embedded_nal::TcpErrorKind {
×
87
        embedded_nal::TcpErrorKind::Other
×
88
    }
×
89
}
90

91
impl From<nb::Error<StackError>> for StackError {
92
    fn from(inner: nb::Error<StackError>) -> Self {
×
93
        match inner {
×
94
            nb::Error::WouldBlock => StackError::WouldBlock,
×
95
            nb::Error::Other(e) => e,
×
96
        }
97
    }
×
98
}
99

100
impl core::fmt::Display for StackError {
101
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
×
102
        match self {
×
103
            Self::WouldBlock => write!(f, "Operation would block"),
×
104
            Self::GeneralTimeout => write!(f, "General timeout"),
×
105
            Self::ConnectTimeout => write!(f, "TCP connection timed out"),
×
106
            Self::RecvTimeout => write!(f, "Receive timeout"),
×
107
            Self::SendTimeout => write!(f, "Send timeout"),
×
108
            Self::OutOfSockets => write!(f, "Out of sockets"),
×
109
            Self::SocketAlreadyInUse => write!(f, "Socket already in use"),
×
110
            Self::CloseFailed => write!(f, "Close failed"),
×
111
            Self::Unexpected => write!(f, "Unexpected error"),
×
112
            Self::DispatchError(err) => write!(f, "Dispatch error: {}", err),
×
113
            Self::ConnectSendFailed(err) => write!(f, "Connect send failed: {}", err),
×
114
            Self::ReceiveFailed(err) => write!(f, "Receive failed: {}", err),
×
115
            Self::SendSendFailed(err) => write!(f, "Send send failed: {}", err),
×
116
            Self::SendCloseFailed(err) => write!(f, "Send close failed: {}", err),
×
117
            Self::BindFailed(err) => write!(f, "Bind failed: {}", err),
×
118
            Self::WincWifiFail(err) => write!(f, "WincWifi fail: {}", err),
×
119
            Self::OpFailed(err) => write!(f, "Operation failed: {}", err),
×
120
            Self::DnsTimeout => write!(f, "DNS lookup timed out"),
×
121
            Self::DnsFailed => write!(f, "DNS lookup failed"),
×
122
            Self::InvalidState => write!(f, "Invalid state"),
×
123
            Self::AlreadyConnected => write!(f, "Already connected"),
×
124
            Self::ApJoinFailed(err) => write!(f, "Access point join failed: {}", err),
×
125
            Self::ApScanFailed(err) => write!(f, "Access point scan failed: {}", err),
×
126
            Self::ContinueOperation => write!(f, "Continue operation"),
×
127
            Self::SocketNotFound => write!(f, "Socket not found"),
×
128
            Self::InvalidParameters => write!(f, "Invalid parameters"),
×
NEW
129
            Self::InvalidResponse => write!(f, "Invalid response"),
×
130
            #[cfg(feature = "experimental-ota")]
131
            Self::OtaFail(err) => write!(f, "Ota failure: {:?}", err),
132
        }
133
    }
×
134
}
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