quic_rpc/transport/misc/
mod.rsuse futures_lite::stream;
use futures_sink::Sink;
use crate::{
transport::{ConnectionErrors, ServerEndpoint},
RpcMessage,
};
use std::convert::Infallible;
use super::ConnectionCommon;
#[derive(Debug, Clone, Default)]
pub struct DummyServerEndpoint;
impl ConnectionErrors for DummyServerEndpoint {
type OpenError = Infallible;
type RecvError = Infallible;
type SendError = Infallible;
}
impl<In: RpcMessage, Out: RpcMessage> ConnectionCommon<In, Out> for DummyServerEndpoint {
type RecvStream = stream::Pending<Result<In, Self::RecvError>>;
type SendSink = Box<dyn Sink<Out, Error = Self::SendError> + Unpin + Send + Sync>;
}
impl<In: RpcMessage, Out: RpcMessage> ServerEndpoint<In, Out> for DummyServerEndpoint {
async fn accept(&self) -> Result<(Self::SendSink, Self::RecvStream), Self::OpenError> {
futures_lite::future::pending().await
}
fn local_addr(&self) -> &[super::LocalAddr] {
&[]
}
}