xwebtransport_core/utils/
dummy.rs1use async_trait::async_trait;
2
3use crate::Streams;
4
5use super::maybe;
6
7#[derive(Debug)]
8pub struct Connecting<T>(pub T);
9
10#[cfg_attr(not(target_family = "wasm"), async_trait)]
11#[cfg_attr(target_family = "wasm", async_trait(?Send))]
12impl<T> crate::traits::Connecting for Connecting<T>
13where
14 T: maybe::Send,
15{
16 type Connection = T;
17 type Error = std::convert::Infallible;
18
19 async fn wait_connect(self) -> Result<Self::Connection, Self::Error> {
20 Ok(self.0)
21 }
22}
23
24#[derive(Debug)]
25pub struct OpeningUniStream<T: Streams>(pub T::SendStream);
26
27#[cfg_attr(not(target_family = "wasm"), async_trait)]
28#[cfg_attr(target_family = "wasm", async_trait(?Send))]
29impl<T> crate::traits::OpeningUniStream for OpeningUniStream<T>
30where
31 T: Streams,
32{
33 type Streams = T;
34 type Error = std::convert::Infallible;
35
36 async fn wait_uni(self) -> Result<<T as Streams>::SendStream, Self::Error> {
37 Ok(self.0)
38 }
39}
40
41#[derive(Debug)]
42pub struct OpeningBiStream<T: Streams>(pub (T::SendStream, T::RecvStream));
43
44#[cfg_attr(not(target_family = "wasm"), async_trait)]
45#[cfg_attr(target_family = "wasm", async_trait(?Send))]
46impl<T> crate::traits::OpeningBiStream for OpeningBiStream<T>
47where
48 T: Streams,
49{
50 type Streams = T;
51 type Error = std::convert::Infallible;
52
53 async fn wait_bi(self) -> Result<crate::traits::BiStreamsFor<T>, Self::Error> {
54 Ok(self.0)
55 }
56}