MCPcopy Create free account
hub / github.com/chanced/jsonptr / validate

Function validate

src/pointer.rs:1353–1361  ·  view source on GitHub ↗
(value: &str)

Source from the content-addressed store, hash-verified

1351impl std::error::Error for ReplaceError {}
1352
1353const fn validate(value: &str) -> Result<&str, ParseError> {
1354 if value.is_empty() {
1355 return Ok(value);
1356 }
1357 if let Err(err) = validate_bytes(value.as_bytes(), 0) {
1358 return Err(err);
1359 }
1360 Ok(value)
1361}
1362
1363const fn validate_bytes(bytes: &[u8], offset: usize) -> Result<(), ParseError> {
1364 if bytes[0] != b'/' && offset == 0 {

Callers 2

parseMethod · 0.85
try_fromMethod · 0.85

Calls 2

validate_bytesFunction · 0.85
is_emptyMethod · 0.80

Tested by

no test coverage detected