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

Function get_from_range

src/pointer/slice.rs:307–327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

305
306 #[test]
307 fn get_from_range() {
308 let ptr = Pointer::from_static("/foo/bar/qux");
309 let s = ptr.get(0..);
310 assert_eq!(s, Some(ptr));
311 let s = ptr.get(1..);
312 assert_eq!(s, Some(Pointer::from_static("/bar/qux")));
313 let s = ptr.get(2..);
314 assert_eq!(s, Some(Pointer::from_static("/qux")));
315 let s = ptr.get(3..);
316 assert_eq!(s, None);
317
318 let ptr = Pointer::from_static("/");
319 let s = ptr.get(0..);
320 assert_eq!(s, Some(ptr));
321 let s = ptr.get(1..);
322 assert_eq!(s, None);
323
324 let ptr = Pointer::from_static("");
325 let s = ptr.get(0..);
326 assert_eq!(s, None);
327 }
328
329 #[test]
330 fn get_to_range() {

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected