gdbstub/conn/impls/
boxed.rs

1use crate::conn::Connection;
2use crate::conn::ConnectionExt;
3use alloc::boxed::Box;
4
5impl<E> Connection for Box<dyn Connection<Error = E>> {
6    type Error = E;
7
8    fn write(&mut self, byte: u8) -> Result<(), Self::Error> {
9        (**self).write(byte)
10    }
11
12    fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
13        (**self).write_all(buf)
14    }
15
16    fn flush(&mut self) -> Result<(), Self::Error> {
17        (**self).flush()
18    }
19
20    fn on_session_start(&mut self) -> Result<(), Self::Error> {
21        (**self).on_session_start()
22    }
23}
24
25impl<E> Connection for Box<dyn ConnectionExt<Error = E>> {
26    type Error = E;
27
28    fn write(&mut self, byte: u8) -> Result<(), Self::Error> {
29        (**self).write(byte)
30    }
31
32    fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
33        (**self).write_all(buf)
34    }
35
36    fn flush(&mut self) -> Result<(), Self::Error> {
37        (**self).flush()
38    }
39
40    fn on_session_start(&mut self) -> Result<(), Self::Error> {
41        (**self).on_session_start()
42    }
43}
44
45impl<E> ConnectionExt for Box<dyn ConnectionExt<Error = E>> {
46    fn read(&mut self) -> Result<u8, Self::Error> {
47        (**self).read()
48    }
49
50    fn peek(&mut self) -> Result<Option<u8>, Self::Error> {
51        (**self).peek()
52    }
53}