MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / copy

Function copy

rust/stringzilla.rs:903–918  ·  view source on GitHub ↗
(target: &mut T, source: &S)

Source from the content-addressed store, hash-verified

901/// with the contents of another byte slice.
902#[inline(always)]
903pub fn copy<T, S>(target: &mut T, source: &S)
904where
905 T: AsMut<[u8]> + ?Sized,
906 S: AsRef<[u8]> + ?Sized,
907{
908 let target_slice = target.as_mut();
909 let source_slice = source.as_ref();
910 assert!(target_slice.len() >= source_slice.len());
911 unsafe {
912 sz_copy(
913 target_slice.as_mut_ptr() as *mut c_void,
914 source_slice.as_ptr() as *const c_void,
915 source_slice.len(),
916 );
917 }
918}
919
920/// Performs a lookup transformation (LUT), mapping contents of a buffer into the same or other
921/// memory region, taking a byte substitution value from the provided table.

Callers 4

replace_all_with_finderFunction · 0.85
copy_size_checksFunction · 0.85
operator()Method · 0.85
repeatFunction · 0.85

Calls 3

as_ptrMethod · 0.80
lenMethod · 0.80
sz_copyFunction · 0.50

Tested by 1

repeatFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…