pub trait RangeVecAllocOps<T: RangeInfo> {
// Required methods
fn merge_add(&mut self, new_info: T) -> Result<(), RangeError<T>>;
fn merge_remove(
&mut self,
range: Range<T::Type>,
) -> Result<(), RangeError<T>>;
fn merge_extend<I>(&mut self, ranges: I) -> Result<(), RangeError<T>>
where I: IntoIterator<Item = T>;
fn contains_point(&self, value: T::Type) -> bool;
}Expand description
RangeSet 操作 trait(alloc 版本),为带分配器的容器提供区间集合功能 相比 RangeSetOps,不需要用户提供临时缓冲区
Required Methods§
Sourcefn merge_add(&mut self, new_info: T) -> Result<(), RangeError<T>>
fn merge_add(&mut self, new_info: T) -> Result<(), RangeError<T>>
添加一个区间(会自动合并相邻区间)
Sourcefn merge_remove(&mut self, range: Range<T::Type>) -> Result<(), RangeError<T>>
fn merge_remove(&mut self, range: Range<T::Type>) -> Result<(), RangeError<T>>
删除一个区间
Sourcefn merge_extend<I>(&mut self, ranges: I) -> Result<(), RangeError<T>>where
I: IntoIterator<Item = T>,
fn merge_extend<I>(&mut self, ranges: I) -> Result<(), RangeError<T>>where
I: IntoIterator<Item = T>,
批量添加多个区间
Sourcefn contains_point(&self, value: T::Type) -> bool
fn contains_point(&self, value: T::Type) -> bool
查询某个值是否落在任意一个区间中
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.