(&mut self, src: &mut BytesMut)
| 34 | type Error = io::Error; |
| 35 | |
| 36 | fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> { |
| 37 | match self.state { |
| 38 | CodecState::WaitingForStartup => { |
| 39 | if let Some(msg) = decode_startup_message(src)? { |
| 40 | self.state = CodecState::Normal; |
| 41 | Ok(Some(msg)) |
| 42 | } else { |
| 43 | Ok(None) |
| 44 | } |
| 45 | } |
| 46 | CodecState::Normal => decode_normal_message(src), |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | impl Encoder<BackendMessage> for PostgresCodec { |