MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / write_and_read

Function write_and_read

nodedb/src/data/io/aligned_buf.rs:113–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

111
112 #[test]
113 fn write_and_read() {
114 let mut buf = AlignedBuf::new(4096).unwrap();
115 let data = b"hello io_uring";
116 unsafe {
117 std::ptr::copy_nonoverlapping(data.as_ptr(), buf.as_mut_ptr(), data.len());
118 let slice = buf.as_slice(data.len());
119 assert_eq!(slice, data);
120 }
121 }
122
123 #[test]
124 fn to_vec_copies() {

Callers

nothing calls this directly

Calls 4

as_ptrMethod · 0.45
as_mut_ptrMethod · 0.45
lenMethod · 0.45
as_sliceMethod · 0.45

Tested by

no test coverage detected