MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / range_is_empty

Function range_is_empty

crates/commitlog/src/commitlog.rs:1051–1064  ·  view source on GitHub ↗

`range_bounds_is_empty` https://github.com/rust-lang/rust/issues/137300 This is correct for integers, but unsound for arbitrary `T`, so unlikely to be stabilized.

(range: &impl RangeBounds<u64>)

Source from the content-addressed store, hash-verified

1049// This is correct for integers, but unsound for arbitrary `T`, so unlikely to
1050// be stabilized.
1051fn range_is_empty(range: &impl RangeBounds<u64>) -> bool {
1052 use std::ops::Bound::*;
1053
1054 #[rustfmt::skip]
1055 let not_empty = match (range.start_bound(), range.end_bound()) {
1056 (Unbounded, _) | (_, Unbounded) => true,
1057 (Included(start), Excluded(end))
1058 | (Excluded(start), Included(end))
1059 | (Excluded(start), Excluded(end)) => start < end,
1060 (Included(start), Included(end)) => start <= end,
1061 };
1062
1063 !not_empty
1064}
1065
1066#[cfg(test)]
1067mod tests {

Callers 1

Calls 2

start_boundMethod · 0.45
end_boundMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…