|
| 1 | +use std::task::{Context, Poll}; |
| 2 | + |
| 3 | +use bytes::Buf; |
| 4 | + |
| 5 | +pub(super) struct Conn<Q>(Q); |
| 6 | + |
| 7 | +pub(super) struct BidiStream<S>(S); |
| 8 | +pub(super) struct SendStream<S>(S); |
| 9 | +pub(super) struct RecvStream<S>(S); |
| 10 | + |
| 11 | +impl<Q, B> h3::quic::Connection<B> for Conn<Q> |
| 12 | +where |
| 13 | + Q: crate::rt::quic::Connection<B>, |
| 14 | + B: Buf, |
| 15 | +{ |
| 16 | + type RecvStream = RecvStream<Q::RecvStream>; |
| 17 | + type OpenStreams = Self; |
| 18 | + |
| 19 | + fn poll_accept_recv(&mut self, _cx: &mut Context<'_>) |
| 20 | + -> Poll<Result<Self::RecvStream, h3::quic::ConnectionErrorIncoming>> |
| 21 | + { |
| 22 | + todo!(); |
| 23 | + } |
| 24 | + |
| 25 | + fn poll_accept_bidi(&mut self, _cx: &mut Context<'_>) |
| 26 | + -> Poll<Result<Self::BidiStream, h3::quic::ConnectionErrorIncoming>> |
| 27 | + { |
| 28 | + todo!(); |
| 29 | + } |
| 30 | + |
| 31 | + fn opener(&self) -> Self::OpenStreams { |
| 32 | + todo!(); |
| 33 | + } |
| 34 | +} |
| 35 | + |
| 36 | +impl<Q, B> h3::quic::OpenStreams<B> for Conn<Q> |
| 37 | +where |
| 38 | + Q: crate::rt::quic::Connection<B>, |
| 39 | + B: Buf, |
| 40 | +{ |
| 41 | + type BidiStream = BidiStream<Q::BidiStream>; |
| 42 | + type SendStream = SendStream<Q::SendStream>; |
| 43 | + |
| 44 | + fn poll_open_send(&mut self, _cx: &mut Context<'_>) |
| 45 | + -> Poll<Result<Self::SendStream, h3::quic::StreamErrorIncoming>> |
| 46 | + { |
| 47 | + todo!(); |
| 48 | + } |
| 49 | + |
| 50 | + fn poll_open_bidi(&mut self, _cx: &mut Context<'_>) |
| 51 | + -> Poll<Result<Self::BidiStream, h3::quic::StreamErrorIncoming>> |
| 52 | + { |
| 53 | + todo!(); |
| 54 | + } |
| 55 | + |
| 56 | + fn close(&mut self, _: h3::error::Code, _: &[u8]) { |
| 57 | + |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +impl<S, B> h3::quic::SendStream<B> for BidiStream<S> |
| 62 | +where |
| 63 | + S: crate::rt::quic::SendStream<B>, |
| 64 | + B: Buf, |
| 65 | +{ |
| 66 | + // Required methods |
| 67 | + fn poll_ready( |
| 68 | + &mut self, |
| 69 | + cx: &mut Context<'_>, |
| 70 | + ) -> Poll<Result<(), h3::quic::StreamErrorIncoming>> { |
| 71 | + todo!(); |
| 72 | + } |
| 73 | + fn send_data<T: Into<h3::quic::WriteBuf<B>>>( |
| 74 | + &mut self, |
| 75 | + data: T, |
| 76 | + ) -> Result<(), h3::quic::StreamErrorIncoming> { |
| 77 | + todo!(); |
| 78 | + } |
| 79 | + fn poll_finish( |
| 80 | + &mut self, |
| 81 | + cx: &mut Context<'_>, |
| 82 | + ) -> Poll<Result<(), h3::quic::StreamErrorIncoming>> { |
| 83 | + todo!(); |
| 84 | + } |
| 85 | + fn reset(&mut self, reset_code: u64) { |
| 86 | + todo!(); |
| 87 | + } |
| 88 | + fn send_id(&self) -> h3::quic::StreamId { |
| 89 | + todo!() |
| 90 | + } |
| 91 | +} |
| 92 | + |
| 93 | +impl<S, B> h3::quic::SendStream<B> for SendStream<S> |
| 94 | +where |
| 95 | + S: crate::rt::quic::SendStream<B>, |
| 96 | + B: Buf, |
| 97 | +{ |
| 98 | + // Required methods |
| 99 | + fn poll_ready( |
| 100 | + &mut self, |
| 101 | + cx: &mut Context<'_>, |
| 102 | + ) -> Poll<Result<(), h3::quic::StreamErrorIncoming>> { |
| 103 | + todo!(); |
| 104 | + } |
| 105 | + fn send_data<T: Into<h3::quic::WriteBuf<B>>>( |
| 106 | + &mut self, |
| 107 | + data: T, |
| 108 | + ) -> Result<(), h3::quic::StreamErrorIncoming> { |
| 109 | + todo!(); |
| 110 | + } |
| 111 | + fn poll_finish( |
| 112 | + &mut self, |
| 113 | + cx: &mut Context<'_>, |
| 114 | + ) -> Poll<Result<(), h3::quic::StreamErrorIncoming>> { |
| 115 | + todo!(); |
| 116 | + } |
| 117 | + fn reset(&mut self, reset_code: u64) { |
| 118 | + todo!(); |
| 119 | + } |
| 120 | + fn send_id(&self) -> h3::quic::StreamId { |
| 121 | + todo!() |
| 122 | + } |
| 123 | +} |
| 124 | + |
| 125 | +impl<S> h3::quic::RecvStream for BidiStream<S> |
| 126 | +where |
| 127 | + S: crate::rt::quic::RecvStream, |
| 128 | +{ |
| 129 | + type Buf = S::Buf; |
| 130 | + |
| 131 | + // Required methods |
| 132 | + fn poll_data( |
| 133 | + &mut self, |
| 134 | + cx: &mut Context<'_>, |
| 135 | + ) -> Poll<Result<Option<Self::Buf>, h3::quic::StreamErrorIncoming>> { |
| 136 | + todo!(); |
| 137 | + } |
| 138 | + fn stop_sending(&mut self, error_code: u64) { |
| 139 | + todo!(); |
| 140 | + } |
| 141 | + fn recv_id(&self) -> h3::quic::StreamId { |
| 142 | + todo!(); |
| 143 | + } |
| 144 | +} |
| 145 | + |
| 146 | +impl<S> h3::quic::RecvStream for RecvStream<S> |
| 147 | +where |
| 148 | + S: crate::rt::quic::RecvStream, |
| 149 | +{ |
| 150 | + type Buf = S::Buf; |
| 151 | + |
| 152 | + // Required methods |
| 153 | + fn poll_data( |
| 154 | + &mut self, |
| 155 | + cx: &mut Context<'_>, |
| 156 | + ) -> Poll<Result<Option<Self::Buf>, h3::quic::StreamErrorIncoming>> { |
| 157 | + todo!(); |
| 158 | + } |
| 159 | + fn stop_sending(&mut self, error_code: u64) { |
| 160 | + todo!(); |
| 161 | + } |
| 162 | + fn recv_id(&self) -> h3::quic::StreamId { |
| 163 | + todo!(); |
| 164 | + } |
| 165 | +} |
0 commit comments