pub struct TextCoordinates { /* private fields */ }Expand description
A checked conversion index containing Unicode scalar boundaries only.
Implementations§
Source§impl TextCoordinates
impl TextCoordinates
pub fn new(text: &str) -> Self
Sourcepub fn new_budgeted(
text: &str,
budget: &MemoryBudget,
poll: &mut dyn FnMut() -> AnalysisResult<()>,
) -> AnalysisResult<Budgeted<Self>>
pub fn new_budgeted( text: &str, budget: &MemoryBudget, poll: &mut dyn FnMut() -> AnalysisResult<()>, ) -> AnalysisResult<Budgeted<Self>>
Construct a scalar index with caller-owned byte limits and cancellation. ASCII needs no boundary buffer; other input reserves one entry per scalar and its end boundary.
pub fn utf8_len(&self) -> usize
pub fn utf16_len(&self) -> usize
pub fn utf8_to_utf16(&self, offset: usize) -> AnalysisResult<usize>
pub fn utf16_to_utf8(&self, offset: usize) -> AnalysisResult<usize>
pub fn offsets(&self, utf8: Range<usize>) -> AnalysisResult<SourceOffsets>
Sourcepub fn covering_offsets_utf16(
&self,
utf16: Range<usize>,
) -> AnalysisResult<SourceOffsets>
pub fn covering_offsets_utf16( &self, utf16: Range<usize>, ) -> AnalysisResult<SourceOffsets>
Retain exact UTF-16 coordinates and cover split surrogate pairs in UTF-8.
An empty range inside a pair covers that scalar; an empty range at a scalar boundary remains empty.
Trait Implementations§
Source§impl Clone for TextCoordinates
impl Clone for TextCoordinates
Source§fn clone(&self) -> TextCoordinates
fn clone(&self) -> TextCoordinates
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextCoordinates
impl Debug for TextCoordinates
impl Eq for TextCoordinates
Source§impl PartialEq for TextCoordinates
impl PartialEq for TextCoordinates
impl StructuralPartialEq for TextCoordinates
Auto Trait Implementations§
impl Freeze for TextCoordinates
impl RefUnwindSafe for TextCoordinates
impl Send for TextCoordinates
impl Sync for TextCoordinates
impl Unpin for TextCoordinates
impl UnsafeUnpin for TextCoordinates
impl UnwindSafe for TextCoordinates
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