pub enum HitGranularity {
Cluster,
Segment,
}Expand description
How precisely a ContentHit::pos resolved — the marker a caret UI reads to
decide whether to trust the offset. The value is never sub-cluster; the two
variants distinguish the finest this API offers from the segment floor it
degrades to.
Variants§
Cluster
Cluster-exact: pos is the first content char of the grapheme cluster
under the point. The finest resolution — a char that escaped to several
generated bytes (*→\*, 你→3, the //→\/\/ coupling) still floors
to its cluster’s first char, so this is not sub-character. A caret UI
can place the caret at pos directly.
Segment
Segment-floored: the point landed on origin-less ink (list markers,
numbering, a multi-line code fence’s interior — spans that resolve to no
single run), so pos degraded to the containing segment’s content start
rather than a wrong finer position. A caret UI should treat pos as the
segment it selected, not a within-segment caret.
Trait Implementations§
Source§impl Clone for HitGranularity
impl Clone for HitGranularity
Source§fn clone(&self) -> HitGranularity
fn clone(&self) -> HitGranularity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for HitGranularity
Source§impl Debug for HitGranularity
impl Debug for HitGranularity
Source§impl<'de> Deserialize<'de> for HitGranularity
impl<'de> Deserialize<'de> for HitGranularity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for HitGranularity
Source§impl PartialEq for HitGranularity
impl PartialEq for HitGranularity
Source§impl Serialize for HitGranularity
impl Serialize for HitGranularity
impl StructuralPartialEq for HitGranularity
Auto Trait Implementations§
impl Freeze for HitGranularity
impl RefUnwindSafe for HitGranularity
impl Send for HitGranularity
impl Sync for HitGranularity
impl Unpin for HitGranularity
impl UnsafeUnpin for HitGranularity
impl UnwindSafe for HitGranularity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.