MCPcopy Create free account
hub / github.com/bajrangCoder/acodex_server / encode

Method encode

src/lsp.rs:493–502  ·  view source on GitHub ↗
(&mut self, item: String, dst: &mut BytesMut)

Source from the content-addressed store, hash-verified

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
505impl Decoder for LspFrameCodec {

Callers

nothing calls this directly

Calls 2

number_of_digitsFunction · 0.85
flushMethod · 0.80

Tested by

no test coverage detected