1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#![allow(unused_variables)] use crate::adapter::{ Resource, Remote, Local, Adapter, SendStatus, AcceptedType, ReadStatus, ConnectionInfo, ListeningInfo, }; use crate::remote_addr::{RemoteAddr}; use mio::event::{Source}; use std::net::{SocketAddr}; use std::io::{self}; pub struct MyAdapter; impl Adapter for MyAdapter { type Remote = RemoteResource; type Local = LocalResource; } pub struct RemoteResource; impl Resource for RemoteResource { fn source(&mut self) -> &mut dyn Source { todo!(); } } impl Remote for RemoteResource { fn connect(remote_addr: RemoteAddr) -> io::Result<ConnectionInfo<Self>> { todo!(); } fn receive(&self, process_data: &dyn Fn(&[u8])) -> ReadStatus { todo!(); } fn send(&self, data: &[u8]) -> SendStatus { todo!(); } } pub struct LocalResource; impl Resource for LocalResource { fn source(&mut self) -> &mut dyn Source { todo!(); } } impl Local for LocalResource { type Remote = RemoteResource; fn listen(addr: SocketAddr) -> io::Result<ListeningInfo<Self>> { todo!(); } fn accept(&self, accept_remote: &dyn Fn(AcceptedType<'_, Self::Remote>)) { todo!(); } }