MCPcopy Create free account
hub / github.com/cosdata/cosdata / tapered_skips

Function tapered_skips

src/models/common.rs:433–444  ·  view source on GitHub ↗
(skips: i8, cur_distance: i8, max_distance: i8)

Source from the content-addressed store, hash-verified

431//typically skips is 1 while near
432#[allow(dead_code)]
433pub fn tapered_skips(skips: i8, cur_distance: i8, max_distance: i8) -> i8 {
434 // Calculate the distance ratio (0.0 to 1.0)
435 let distance_ratio = cur_distance as f32 / max_distance as f32;
436
437 // Use match expression for efficient logic based on distance ratio
438 match distance_ratio {
439 ratio if ratio < 0.25 => skips,
440 ratio if ratio < 0.5 => skips * 2,
441 ratio if ratio < 0.75 => skips * 3,
442 _ => skips * 4, // Distance ratio >= 0.75
443 }
444}
445
446#[allow(dead_code)]
447pub fn tuple_to_string(tuple: (u32, u32)) -> String {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected