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

Method from_range_bounds

crates/commitlog/src/stream/common.rs:87–100  ·  view source on GitHub ↗
(b: impl RangeBounds<u64>)

Source from the content-addressed store, hash-verified

85
86impl RangeFromMaybeToInclusive {
87 pub fn from_range_bounds(b: impl RangeBounds<u64>) -> Self {
88 let start = match b.start_bound() {
89 Bound::Unbounded => 0,
90 Bound::Included(start) => *start,
91 Bound::Excluded(start) => start + 1,
92 };
93 let end = match b.end_bound() {
94 Bound::Unbounded => None,
95 Bound::Included(end) => Some(*end),
96 Bound::Excluded(end) => Some(end.saturating_sub(1)),
97 };
98
99 Self { start, end }
100 }
101
102 pub fn is_empty(&self) -> bool {
103 self.end.is_some_and(|end| end < self.start)

Callers

nothing calls this directly

Calls 2

start_boundMethod · 0.45
end_boundMethod · 0.45

Tested by

no test coverage detected