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

Method build

rust/stringzillas.rs:2390–2417  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 5

fingerprint_computationFunction · 0.80
thread_safetyFunction · 0.80
large_batch_processingFunction · 0.80
similarity_estimationFunction · 0.80

Calls 4

get_capabilitiesMethod · 0.80
as_ptrMethod · 0.80
lenMethod · 0.80

Tested by 5

fingerprint_computationFunction · 0.64
thread_safetyFunction · 0.64
large_batch_processingFunction · 0.64
similarity_estimationFunction · 0.64