MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / add_string

Method add_string

src/protocol/buffer_writer.rs:66–73  ·  view source on GitHub ↗
(&mut self, value: &str)

Source from the content-addressed store, hash-verified

64 }
65
66 pub fn add_string(&mut self, value: &str) -> &mut Self {
67 let length = byte_length_utf8(value);
68 self.ensure_capacity(length);
69 let end = self.offset + length;
70 self.buffer[self.offset..end].copy_from_slice(value.as_bytes());
71 self.offset = end;
72 self
73 }
74
75 pub fn add_bytes(&mut self, bytes: &[u8]) -> &mut Self {
76 self.write_be_bytes(bytes);

Callers 1

add_cstringMethod · 0.45

Calls 2

byte_length_utf8Function · 0.85
ensure_capacityMethod · 0.80

Tested by

no test coverage detected