(&mut self, item: String, dst: &mut BytesMut)
| 491 | type Error = CodecError; |
| 492 | |
| 493 | fn encode(&mut self, item: String, dst: &mut BytesMut) -> Result<(), Self::Error> { |
| 494 | if !item.is_empty() { |
| 495 | // Reserve space: "Content-Length: " (16) + digits + "\r\n\r\n" (4) + body |
| 496 | dst.reserve(item.len() + number_of_digits(item.len()) + 20); |
| 497 | let mut writer = dst.writer(); |
| 498 | write!(writer, "Content-Length: {}\r\n\r\n{}", item.len(), item)?; |
| 499 | writer.flush()?; |
| 500 | } |
| 501 | Ok(()) |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | impl Decoder for LspFrameCodec { |
nothing calls this directly
no test coverage detected