pub struct RangeArea<SegmentType: Segment> {
    pub start: usize,
    pub end: usize,
    pub segment: SegmentType,
}

Fields§

§start: usize§end: usize§segment: SegmentType

Implementations§

source§

impl<SegmentType: Segment> RangeArea<SegmentType>

source

pub fn contains(&self, pos: usize) -> bool

当前区间是否包含 pos 这个点

source

pub fn shrink_or_split_if_overlap( &mut self, start: usize, end: usize, args: ArgsType ) -> DiffSet<SegmentType>

尝试空出[start, end)区间。即删除当前区间中和[start, end)相交的部分。

注意,这个函数在内部已经 unmap 了对应的区间中的映射,调用后不需要再手动 unmap。 这个函数默认参数中的 start 和 end 是按页对齐的

source

pub fn split_and_modify_if_overlap( &mut self, start: usize, end: usize, new_flag: IdentType, args: ArgsType ) -> CutSet<SegmentType>

尝试修改与 [start, end) 区间相交的部分的权限。 如果这一修改导致区间分裂,则分别返回分出的每个区间。

source

pub fn is_overlap_with(&self, start: usize, end: usize) -> bool

当前区间与 [start, end) 是否相交

Trait Implementations§

source§

impl<SegmentType: Debug + Segment> Debug for RangeArea<SegmentType>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<SegmentType> RefUnwindSafe for RangeArea<SegmentType>where SegmentType: RefUnwindSafe,

§

impl<SegmentType> Send for RangeArea<SegmentType>where SegmentType: Send,

§

impl<SegmentType> Sync for RangeArea<SegmentType>where SegmentType: Sync,

§

impl<SegmentType> Unpin for RangeArea<SegmentType>where SegmentType: Unpin,

§

impl<SegmentType> UnwindSafe for RangeArea<SegmentType>where SegmentType: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.