kmp-application 0.1.8

Application services of the KMP kernel: the use cases behind ingest, wake, ask, near, rewind and trace
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub const MIN_NATIVE_GRAPH_TRAVERSAL_DEPTH: u32 = 1;
pub const DEFAULT_NATIVE_GRAPH_TRAVERSAL_DEPTH: u32 = 10;
pub const MAX_NATIVE_GRAPH_TRAVERSAL_DEPTH: u32 = 25;

pub fn clamp_native_graph_traversal_depth(depth: u32) -> u32 {
    match depth {
        0 => DEFAULT_NATIVE_GRAPH_TRAVERSAL_DEPTH,
        _ => depth.clamp(
            MIN_NATIVE_GRAPH_TRAVERSAL_DEPTH,
            MAX_NATIVE_GRAPH_TRAVERSAL_DEPTH,
        ),
    }
}

pub fn clamp_native_graph_subtree_depth(depth: u32) -> u32 {
    depth.min(MAX_NATIVE_GRAPH_TRAVERSAL_DEPTH)
}