pub struct ContentHit {
pub field: String,
pub pos: usize,
pub granularity: Option<HitGranularity>,
}Expand description
A resolved point → content position: the schema field a click landed in and
the USV offset into that field’s Content. The forward
position_at direction, paired with
locate (content position → caret rect).
pos is cluster-exact, not sub-character: a hit inside a char that
escaped to several generated bytes (*→\*, 你→3, the //→\/\/
coupling) floors to that cluster’s first content char. A click on
origin-less ink (list markers, numbering, a multi-line code fence’s interior
— spans that resolve to no single run) degrades to the containing segment’s
content start rather than a wrong finer position, and a click off all content
ink resolves to nothing. granularity reports which of
those two happened, so a caret UI need not guess.
Fields§
§field: StringThe content field’s schema path (same address space as
RenderedRegion::field).
pos: usizeUSV offset into the field’s Content.
granularity: Option<HitGranularity>Whether pos is cluster-exact or floored to the segment
start (HitGranularity). None when the backend does not report it (a
hit straight from a backend with no source map, or an older wire payload).
Additive-optional: omitted from the wire when None.
Trait Implementations§
Source§impl Clone for ContentHit
impl Clone for ContentHit
Source§fn clone(&self) -> ContentHit
fn clone(&self) -> ContentHit
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContentHit
impl Debug for ContentHit
Source§impl<'de> Deserialize<'de> for ContentHit
impl<'de> Deserialize<'de> for ContentHit
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 ContentHit
Source§impl PartialEq for ContentHit
impl PartialEq for ContentHit
Source§impl Serialize for ContentHit
impl Serialize for ContentHit
impl StructuralPartialEq for ContentHit
Auto Trait Implementations§
impl Freeze for ContentHit
impl RefUnwindSafe for ContentHit
impl Send for ContentHit
impl Sync for ContentHit
impl Unpin for ContentHit
impl UnsafeUnpin for ContentHit
impl UnwindSafe for ContentHit
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.