drogue_http_client/
mock.rs

1//! Implementations just for the sake of creating compilable documentation.
2
3use drogue_network::addr::HostSocketAddr;
4use drogue_network::tcp::{Mode, TcpError, TcpStack};
5
6pub struct MockStack {}
7
8pub struct MockSocket {}
9
10#[derive(Debug)]
11pub enum MockError {}
12
13impl From<MockError> for TcpError {
14    fn from(_: MockError) -> Self {
15        unimplemented!()
16    }
17}
18
19impl From<MockError> for () {
20    fn from(_: MockError) -> Self {
21        unimplemented!()
22    }
23}
24
25pub fn mock_connection() -> (MockStack, MockSocket) {
26    (MockStack {}, MockSocket {})
27}
28
29impl TcpStack for MockStack {
30    type TcpSocket = MockSocket;
31    type Error = MockError;
32
33    fn open(&self, _: Mode) -> Result<Self::TcpSocket, Self::Error> {
34        unimplemented!()
35    }
36
37    fn connect(
38        &self,
39        _: Self::TcpSocket,
40        _: HostSocketAddr,
41    ) -> Result<Self::TcpSocket, Self::Error> {
42        unimplemented!()
43    }
44
45    fn is_connected(&self, _: &Self::TcpSocket) -> Result<bool, Self::Error> {
46        unimplemented!()
47    }
48
49    fn write(&self, _: &mut Self::TcpSocket, _: &[u8]) -> nb::Result<usize, Self::Error> {
50        unimplemented!()
51    }
52
53    fn read(&self, _: &mut Self::TcpSocket, _: &mut [u8]) -> nb::Result<usize, Self::Error> {
54        unimplemented!()
55    }
56
57    fn close(&self, _: Self::TcpSocket) -> Result<(), Self::Error> {
58        unimplemented!()
59    }
60}