MCPcopy Create free account
hub / github.com/PerroEngine/Perro / validate

Function validate

perro_source/api_modules/perro_resource_api/src/res_path.rs:460–481  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

458 if len == 2 && bytes[segment_start] == b'.' && bytes[segment_start + 1] == b'.' {
459 panic!("ResPath cannot contain .. segment");
460 }
461 segment_start = i + 1;
462 }
463 i += 1;
464 }
465}
466
467const fn starts_with(bytes: &[u8], prefix: &[u8]) -> bool {
468 if bytes.len() < prefix.len() {
469 return false;
470 }
471 let mut i = 0;
472 while i < prefix.len() {
473 if bytes[i] != prefix[i] {
474 return false;
475 }
476 i += 1;
477 }
478 true
479}
480
481const fn contains_scheme(bytes: &[u8]) -> bool {
482 let mut i = 0;
483 while i + 2 < bytes.len() {
484 if bytes[i] == b':' && bytes[i + 1] == b'/' && bytes[i + 2] == b'/' {

Callers 2

try_newMethod · 0.85
internMethod · 0.85

Calls 6

validate_bodyFunction · 0.85
validate_dlcFunction · 0.85
anyMethod · 0.80
is_emptyMethod · 0.45
bytesMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected