use futures::Future; use futures::task::{Context, Poll}; use core::pin::Pin; use tokio::stream::Stream; use async_tungstenite::{tokio::connect_async, tungstenite::Message, WebSocketStream}; use url::Url; use super::packet_connection::IncomingPacket; use std::time::Duration; pub trait RPCInterface { type PacketType; type NetworkError; type Call: RPC, Self::NetworkError>>; fn call(call: &Self::PacketType) -> Self::Call; } pub trait RPC: Future { fn with_timeout(self, timeout: Duration) -> Self; } pub trait ServerEventStream: Stream {} pub struct WSRPCInterface { // TODO _unused: PacketType, stream: WebSocketStream, } impl WSRPCInterface { fn create(ws_stream: WebSocketStream) -> (Self, WSServerEventStream) { // TODO panic!("Not yet implemented."); } } impl RPCInterface for WSRPCInterface { type PacketType = P; type NetworkError = String; // TODO type Call = WSRPC; fn call(call: &Self::PacketType) -> Self::Call { // TODO panic!("Not yet implemented."); } } pub struct WSRPC { // TODO _unused: PacketType, } impl

Future for WSRPC

{ type Output = Result, String>; fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { // TODO panic!("Not yet implemented."); } } impl

RPC for WSRPC

{ fn with_timeout(self, timeout: Duration) -> Self { // TODO panic!("Not yet implemented."); } } struct WSServerEventStream { _unused: PacketType, } impl

Stream for WSServerEventStream

{ type Item = P; fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { // TODO panic!("Not yet implemented."); } } pub async fn low_level_integration_test_client(address: String) { let url = Url::parse(&address).unwrap(); let (mut ws_stream, _) = connect_async(url).await.unwrap(); // TODO }