Performs a lookup transformation (LUT), mapping contents of a buffer into the same or other memory region, taking a byte substitution value from the provided table. # Arguments `target`: A mutable buffer to populate. `source`: An immutable buffer to map from. `table`: Lookup table of 256 substitution values. # Examples To convert uppercase ASCII characters to lowercase: ``` use stringzilla::s
(target: &mut T, source: &S, table: [u8; 256])
| 944 | /// ``` |
| 945 | /// |
| 946 | pub fn lookup<T, S>(target: &mut T, source: &S, table: [u8; 256]) |
| 947 | where |
| 948 | T: AsMut<[u8]> + ?Sized, |
| 949 | S: AsRef<[u8]> + ?Sized, |
| 950 | { |
| 951 | let target_slice = target.as_mut(); |
| 952 | let source_slice = source.as_ref(); |
| 953 | assert!(target_slice.len() >= source_slice.len()); |
| 954 | unsafe { |
| 955 | sz_lookup( |
| 956 | target_slice.as_mut_ptr() as *mut c_void, |
| 957 | source_slice.len(), |
| 958 | source_slice.as_ptr() as *const c_void, |
| 959 | table.as_ptr() as _, |
| 960 | ); |
| 961 | } |
| 962 | } |
| 963 | |
| 964 | /// Performs a lookup transformation (LUT), mapping contents of a buffer into the same or other |
| 965 | /// memory region, taking a byte substitution value from the provided table. |
no test coverage detected
searching dependent graphs…