pub struct RangeData {
pub start: BoundaryPoint,
pub end: BoundaryPoint,
}Expand description
Range の状態データ(純粋構造体)
Fields§
§start: BoundaryPoint§end: BoundaryPointImplementations§
Source§impl RangeData
impl RangeData
pub const fn new(start: BoundaryPoint, end: BoundaryPoint) -> Self
Sourcepub fn is_collapsed(&self) -> bool
pub fn is_collapsed(&self) -> bool
始点と終点が一致している(折りたたまれている)か
Sourcepub fn collapse(&mut self, to_start: bool)
pub fn collapse(&mut self, to_start: bool)
Range を折りたたむ。
to_start == true なら終点を始点に揃える。
to_start == false なら始点を終点に揃える。
Sourcepub fn set_start(&mut self, point: BoundaryPoint)
pub fn set_start(&mut self, point: BoundaryPoint)
始点を設定する。 W3C 仕様: 新しい始点が現在の終点より後にある場合、終点も新しい始点に揃えて折りたたむ。
Sourcepub fn set_end(&mut self, point: BoundaryPoint)
pub fn set_end(&mut self, point: BoundaryPoint)
終点を設定する。 W3C 仕様: 新しい終点が現在の始点より前にある場合、始点も新しい終点に揃えて折りたたむ。
Sourcepub fn compare_boundary_points(
&self,
how: u16,
source: &Self,
) -> Result<i16, &'static str>
pub fn compare_boundary_points( &self, how: u16, source: &Self, ) -> Result<i16, &'static str>
compareBoundaryPoints の計算。
how に応じて比較対象を選び、this が前なら -1、等しければ 0、後なら 1 を返す。
Sourcepub fn is_point_in_range(&self, point: BoundaryPoint) -> bool
pub fn is_point_in_range(&self, point: BoundaryPoint) -> bool
点 point が Range に含まれているか判定(isPointInRange)。
start <= point && point <= end
Sourcepub fn intersects(
&self,
other_start: BoundaryPoint,
other_end: BoundaryPoint,
) -> bool
pub fn intersects( &self, other_start: BoundaryPoint, other_end: BoundaryPoint, ) -> bool
別の範囲 (other_start, other_end) と交差しているか判定(intersectsNode 等)。
Trait Implementations§
impl Copy for RangeData
impl Eq for RangeData
impl StructuralPartialEq for RangeData
Auto Trait Implementations§
impl Freeze for RangeData
impl RefUnwindSafe for RangeData
impl Send for RangeData
impl Sync for RangeData
impl Unpin for RangeData
impl UnsafeUnpin for RangeData
impl UnwindSafe for RangeData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.