MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / rows_bound_to_idx

Function rows_bound_to_idx

nodedb-query/src/window/frame.rs:71–79  ·  view source on GitHub ↗
(bound: &FrameBound, pos: usize, len: usize, _is_start: bool)

Source from the content-addressed store, hash-verified

69}
70
71fn rows_bound_to_idx(bound: &FrameBound, pos: usize, len: usize, _is_start: bool) -> usize {
72 match bound {
73 FrameBound::UnboundedPreceding => 0,
74 FrameBound::Preceding(n) => pos.saturating_sub(*n as usize),
75 FrameBound::CurrentRow => pos,
76 FrameBound::Following(n) => (pos + *n as usize).min(len.saturating_sub(1)),
77 FrameBound::UnboundedFollowing => len.saturating_sub(1),
78 }
79}
80
81// ── RANGE ─────────────────────────────────────────────────────────────────────
82

Callers 1

rows_boundsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected