Build the fingerprinting engine with the configured parameters. Creates an optimized fingerprinting engine based on the builder configuration and the target device capabilities. The engine automatically adapts its implementation strategy based on available hardware features. # Parameter Resolution - **alphabet_size = 0**: Defaults to 256 (binary mode) - **window_widths = None**: Uses hardware-o
(self, device: &DeviceScope)
| 2388 | /// assert!(result.is_ok()); |
| 2389 | /// ``` |
| 2390 | pub fn build(self, device: &DeviceScope) -> Result<Fingerprints, Error> { |
| 2391 | let mut engine: FingerprintsHandle = ptr::null_mut(); |
| 2392 | let capabilities = device.get_capabilities().unwrap_or(0); |
| 2393 | |
| 2394 | let (widths_ptr, widths_len) = match &self.window_widths { |
| 2395 | Some(widths) => (widths.as_ptr(), widths.len()), |
| 2396 | None => (ptr::null(), 0), |
| 2397 | }; |
| 2398 | |
| 2399 | let mut error_msg: *const c_char = ptr::null(); |
| 2400 | let status = unsafe { |
| 2401 | szs_fingerprints_init( |
| 2402 | self.dimensions, |
| 2403 | self.alphabet_size, |
| 2404 | widths_ptr, |
| 2405 | widths_len, |
| 2406 | ptr::null(), // No custom allocator |
| 2407 | capabilities, |
| 2408 | &mut engine, |
| 2409 | &mut error_msg, |
| 2410 | ) |
| 2411 | }; |
| 2412 | |
| 2413 | match status { |
| 2414 | Status::Success => Ok(Fingerprints { handle: engine }), |
| 2415 | err => Err(rust_error_from_c_message(err, error_msg)), |
| 2416 | } |
| 2417 | } |
| 2418 | } |
| 2419 | |
| 2420 | /// High-performance fingerprinting engine for similarity detection and clustering. |