| 1 | use superrust-analyzer cargo futures_codec 0.4.1 crate/::fuserust-analyzer cargo futures_codec 0.4.1 fuse/::Fuserust-analyzer cargo futures_codec 0.4.1 fuse/Fuse#; |
| 2 | use superrust-analyzer cargo futures_codec 0.4.1 crate/::Decoderrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#; |
| 3 | |
| 4 | use bytesrust-analyzer cargo bytes 1.12.1 crate/::BytesMutrust-analyzer cargo bytes 1.12.1 bytes_mut/BytesMut#; |
| 5 | use futuresrust-analyzer cargo futures 0.3.34 crate/::iorust-analyzer cargo futures-util 0.3.34 io/::AsyncReadrust-analyzer cargo futures-io 0.3.34 if_std/AsyncRead#; |
| 6 | use futuresrust-analyzer cargo futures 0.3.34 crate/::{readyrust-analyzer cargo futures-core 0.3.34 task/poll/ready!, Sinkrust-analyzer cargo futures-sink 0.3.34 Sink#, Streamrust-analyzer cargo futures-core 0.3.34 stream/Stream#, TryStreamExtrust-analyzer cargo futures-util 0.3.34 stream/try_stream/TryStreamExt#}; |
| 7 | use pin_projectrust-analyzer cargo pin-project 1.1.13 crate/::pin_projectrust-analyzer cargo pin-project-internal 1.1.13 pin_project:; |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/; |
| 9 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#; |
| 10 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#, DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut#}; |
| 11 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/::Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#; |
| 12 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::taskrust-analyzer cargo std https://github.com/rust-lang/rust/library/std task/::{Contextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/Context#, Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#}; |
| 13 | |
| 14 | /// A `Stream` of messages decoded from an `AsyncRead`. |
| 15 | /// |
| 16 | /// # Example |
| 17 | /// ``` |
| 18 | /// use futures_codec::{BytesCodec, FramedRead}; |
| 19 | /// use futures::TryStreamExt; |
| 20 | /// use bytes::{Bytes}; |
| 21 | /// |
| 22 | /// let buf = [3u8; 3]; |
| 23 | /// let mut framed = FramedRead::new(&buf[..], BytesCodec); |
| 24 | /// |
| 25 | /// # futures::executor::block_on(async move { |
| 26 | /// if let Some(bytes) = framed.try_next().await? { |
| 27 | /// assert_eq!(bytes, Bytes::copy_from_slice(&buf[..])); |
| 28 | /// } |
| 29 | /// # Ok::<_, std::io::Error>(()) |
| 30 | /// # }).unwrap(); |
| 31 | /// ``` |
| 32 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 33 | pub struct FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#<T, D> { |
| 34 | innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner.: FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#<Fuserust-analyzer cargo futures_codec 0.4.1 fuse/Fuse#<T, D>>, |
| 35 | } |
| 36 | |
| 37 | impl<T, D> Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#<T, D> { |
| 38 | type Targetrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`][Deref]Target# = T; |
| 39 | |
| 40 | fn derefrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`][Deref]deref().(&self) -> &T { |
| 41 | &self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner. |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | impl<T, D> DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut# for FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#<T, D> { |
| 46 | fn deref_mutrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`][DerefMut]deref_mut().(&mut self) -> &mut T { |
| 47 | &mut self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner. |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | impl<T, D> FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#<T, D> |
| 52 | where |
| 53 | T: AsyncReadrust-analyzer cargo futures-io 0.3.34 if_std/AsyncRead#, |
| 54 | D: Decoderrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#, |
| 55 | { |
| 56 | /// Creates a new `FramedRead` transport with the given `Decoder`. |
| 57 | pub fn newrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]new().(inner: T, decoder: D) -> Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`] { |
| 58 | Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`] { |
| 59 | innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner.: framed_read_2rust-analyzer cargo futures_codec 0.4.1 framed_read/framed_read_2().(Fuserust-analyzer cargo futures_codec 0.4.1 fuse/Fuse#::newrust-analyzer cargo futures_codec 0.4.1 fuse/impl#[`Fuse<T, U>`]new().(inner, decoder)), |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /// Release the I/O and Decoder |
| 64 | pub fn releaserust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]release().(self: Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]) -> (T, D) { |
| 65 | let fuse = self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner..releaserust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`]release().(); |
| 66 | (fuse.trust-analyzer cargo futures_codec 0.4.1 fuse/Fuse#t., fuse.urust-analyzer cargo futures_codec 0.4.1 fuse/Fuse#u.) |
| 67 | } |
| 68 | |
| 69 | /// Consumes the `FramedRead`, returning its underlying I/O stream. |
| 70 | /// |
| 71 | /// Note that care should be taken to not tamper with the underlying stream |
| 72 | /// of data coming in as it may corrupt the stream of frames otherwise |
| 73 | /// being worked with. |
| 74 | pub fn into_innerrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]into_inner().(self) -> T { |
| 75 | self.releaserust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]release().().0 |
| 76 | } |
| 77 | |
| 78 | /// Returns a reference to the underlying decoder. |
| 79 | /// |
| 80 | /// Note that care should be taken to not tamper with the underlying decoder |
| 81 | /// as it may corrupt the stream of frames otherwise being worked with. |
| 82 | pub fn decoderrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]decoder().(&self) -> &D { |
| 83 | &self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner..urust-analyzer cargo futures_codec 0.4.1 fuse/Fuse#u. |
| 84 | } |
| 85 | |
| 86 | /// Returns a mutable reference to the underlying decoder. |
| 87 | /// |
| 88 | /// Note that care should be taken to not tamper with the underlying decoder |
| 89 | /// as it may corrupt the stream of frames otherwise being worked with. |
| 90 | pub fn decoder_mutrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]decoder_mut().(&mut self) -> &mut D { |
| 91 | &mut self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner..urust-analyzer cargo futures_codec 0.4.1 fuse/Fuse#u. |
| 92 | } |
| 93 | |
| 94 | /// Returns a reference to the read buffer. |
| 95 | pub fn read_bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]read_buffer().(&self) -> &BytesMutrust-analyzer cargo bytes 1.12.1 bytes_mut/BytesMut# { |
| 96 | &self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner..bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer. |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | impl<T, D> Streamrust-analyzer cargo futures-core 0.3.34 stream/Stream# for FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#<T, D> |
| 101 | where |
| 102 | T: AsyncReadrust-analyzer cargo futures-io 0.3.34 if_std/AsyncRead# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#, |
| 103 | D: Decoderrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#, |
| 104 | { |
| 105 | type Itemrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`][Stream]Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<D::Itemrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#Item#, D::Errorrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#Error#>; |
| 106 | |
| 107 | fn poll_nextrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`][Stream]poll_next().(mut self: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<&mut Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`][Stream]>, cx: &mut Contextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/Context#<'_>) -> Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`][Stream]::Itemrust-analyzer cargo futures-core 0.3.34 stream/Stream#Item#>> { |
| 108 | self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#inner..try_poll_next_unpinrust-analyzer cargo futures-util 0.3.34 stream/try_stream/TryStreamExt#try_poll_next_unpin().(cx) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | #[pin_projectrust-analyzer cargo pin-project-internal 1.1.13 pin_project:] |
| 113 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 114 | pub struct FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#<T> { |
| 115 | #[pinrust-analyzer cargo pin-project-internal 1.1.13 pin:] |
| 116 | innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner.: T, |
| 117 | bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer.: BytesMutrust-analyzer cargo bytes 1.12.1 bytes_mut/BytesMut#, |
| 118 | } |
| 119 | |
| 120 | impl<T> Derefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref# for FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#<T> { |
| 121 | type Targetrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][Deref]Target# = T; |
| 122 | |
| 123 | fn derefrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][Deref]deref().(&self) -> &T { |
| 124 | &self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner. |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | impl<T> DerefMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/DerefMut# for FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#<T> { |
| 129 | fn deref_mutrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][DerefMut]deref_mut().(&mut self) -> &mut T { |
| 130 | &mut self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner. |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | const INITIAL_CAPACITYrust-analyzer cargo futures_codec 0.4.1 framed_read/INITIAL_CAPACITY.: usize = 8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().1024; |
| 135 | |
| 136 | pub fn framed_read_2rust-analyzer cargo futures_codec 0.4.1 framed_read/framed_read_2().<T>(inner: T) -> FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#<T> { |
| 137 | FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2# { |
| 138 | innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner., |
| 139 | bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer.: BytesMutrust-analyzer cargo bytes 1.12.1 bytes_mut/BytesMut#::with_capacityrust-analyzer cargo bytes 1.12.1 bytes_mut/impl#[BytesMut]with_capacity().(INITIAL_CAPACITYrust-analyzer cargo futures_codec 0.4.1 framed_read/INITIAL_CAPACITY.), |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | impl<T> Streamrust-analyzer cargo futures-core 0.3.34 stream/Stream# for FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#<T> |
| 144 | where |
| 145 | T: AsyncReadrust-analyzer cargo futures-io 0.3.34 if_std/AsyncRead# + Decoderrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder# + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#, |
| 146 | { |
| 147 | type Itemrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][Stream]Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T::Itemrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#Item#, T::Errorrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#Error#>; |
| 148 | |
| 149 | fn poll_nextrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][Stream]poll_next().(mut self: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<&mut Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][Stream]>, cx: &mut Contextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/Context#<'_>) -> Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][Stream]::Itemrust-analyzer cargo futures-core 0.3.34 stream/Stream#Item#>> { |
| 150 | let this = &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/impl#[`Pin<Ptr>`][DerefMut]deref_mut().self; |
| 151 | |
| 152 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(item) = this.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner..decoderust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#decode().(&mut this.bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 153 | return Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Readyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Ready#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(item))); |
| 154 | } |
| 155 | |
| 156 | let mut buf = [0u8; INITIAL_CAPACITYrust-analyzer cargo futures_codec 0.4.1 framed_read/INITIAL_CAPACITY.]; |
| 157 | |
| 158 | loop { |
| 159 | let n = readyrust-analyzer cargo futures-core 0.3.34 task/poll/ready!!(Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/impl#[`Pin<Ptr>`]new().(&mut this.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner.).poll_readrust-analyzer cargo futures-io 0.3.34 if_std/AsyncRead#poll_read().(cx, &mut buf))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 160 | this.bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer..extend_from_slicerust-analyzer cargo bytes 1.12.1 bytes_mut/impl#[BytesMut]extend_from_slice().(&buf[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#n]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][`Index<I>`]index().); |
| 161 | |
| 162 | let ended = n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0; |
| 163 | |
| 164 | match this.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner..decoderust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#decode().(&mut this.bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 165 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(item) => return Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Readyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Ready#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(item))), |
| 166 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# if ended => { |
| 167 | if this.bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer..is_emptyrust-analyzer cargo bytes 1.12.1 bytes_mut/impl#[BytesMut]is_empty().() { |
| 168 | return Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Readyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Ready#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 169 | } else { |
| 170 | match this.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner..decode_eofrust-analyzer cargo futures_codec 0.4.1 decoder/Decoder#decode_eof().(&mut this.bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 171 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(item) => return Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Readyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Ready#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(item))), |
| 172 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# if this.bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer..is_emptyrust-analyzer cargo bytes 1.12.1 bytes_mut/impl#[BytesMut]is_empty().() => return Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Readyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Ready#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |
| 173 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 174 | return Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#::Readyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#Ready#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]new().( |
| 175 | iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::UnexpectedEofrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#UnexpectedEof#, |
| 176 | "bytes remaining in stream", |
| 177 | ) |
| 178 | .intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))); |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | } |
| 183 | _ => continue, |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | impl<T, I> Sinkrust-analyzer cargo futures-sink 0.3.34 Sink#<I> for FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#<T> |
| 190 | where |
| 191 | T: Sinkrust-analyzer cargo futures-sink 0.3.34 Sink#<I> + Unpinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Unpin#, |
| 192 | { |
| 193 | type Errorrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]Error# = T::Errorrust-analyzer cargo futures-sink 0.3.34 Sink#Error#; |
| 194 | |
| 195 | fn poll_readyrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]poll_ready().(self: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<&mut Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]>, cx: &mut Contextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/Context#) -> Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]::Errorrust-analyzer cargo futures-sink 0.3.34 Sink#Error#>> { |
| 196 | self.projectrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`]project().().innerrust-analyzer cargo futures_codec 0.4.1 framed_read/__FramedRead2Projection#inner..poll_readyrust-analyzer cargo futures-sink 0.3.34 Sink#poll_ready().(cx) |
| 197 | } |
| 198 | fn start_sendrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]start_send().(self: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<&mut Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]>, item: I) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]::Errorrust-analyzer cargo futures-sink 0.3.34 Sink#Error#> { |
| 199 | self.projectrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`]project().().innerrust-analyzer cargo futures_codec 0.4.1 framed_read/__FramedRead2Projection#inner..start_sendrust-analyzer cargo futures-sink 0.3.34 Sink#start_send().(item) |
| 200 | } |
| 201 | fn poll_flushrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]poll_flush().(self: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<&mut Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]>, cx: &mut Contextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/Context#) -> Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]::Errorrust-analyzer cargo futures-sink 0.3.34 Sink#Error#>> { |
| 202 | self.projectrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`]project().().innerrust-analyzer cargo futures_codec 0.4.1 framed_read/__FramedRead2Projection#inner..poll_flushrust-analyzer cargo futures-sink 0.3.34 Sink#poll_flush().(cx) |
| 203 | } |
| 204 | fn poll_closerust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]poll_close().(self: Pinrust-analyzer cargo core https://github.com/rust-lang/rust/library/core pin/Pin#<&mut Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]>, cx: &mut Contextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/wake/Context#) -> Pollrust-analyzer cargo core https://github.com/rust-lang/rust/library/core task/poll/Poll#<Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`][`Sink<I>`]::Errorrust-analyzer cargo futures-sink 0.3.34 Sink#Error#>> { |
| 205 | self.projectrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`]project().().innerrust-analyzer cargo futures_codec 0.4.1 framed_read/__FramedRead2Projection#inner..poll_closerust-analyzer cargo futures-sink 0.3.34 Sink#poll_close().(cx) |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | impl<T> FramedRead2rust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#<T> { |
| 210 | pub fn releaserust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`]release().(self: Selfrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`]) -> T { |
| 211 | self.innerrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#inner. |
| 212 | } |
| 213 | |
| 214 | pub fn bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead2<T>`]buffer().(&self) -> &BytesMutrust-analyzer cargo bytes 1.12.1 bytes_mut/BytesMut# { |
| 215 | &self.bufferrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead2#buffer. |
| 216 | } |
| 217 | } |