MCPcopy Create free account
hub / github.com/awslabs/llrt / bits

Method bits

modules/llrt_buffer/src/buffer.rs:530–543  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

528 }
529 }
530
531 Ok((offset, length, encoding))
532}
533
534fn safe_byte_slice(s: &str, end: usize) -> (&[u8], usize) {
535 let bytes = s.as_bytes();
536
537 if bytes.len() <= end {
538 return (bytes, bytes.len());
539 }
540
541 let valid_end = s
542 .char_indices()
543 .map(|(i, _)| i)
544 .rfind(|&i| i <= end)
545 .unwrap_or(0);
546

Callers 2

write_bufFunction · 0.80
read_bufFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected