pub struct Sentence<'a> {
pub text: &'a str,
pub char_range: Range<usize>,
}Expand description
One sentence of a text: the slice itself, and where it sits as char offsets.
Both fields describe the same span — text is char_range already sliced out. They are
paired rather than left to the caller because a statistics caller wants the substring (to
count words in it) while a highlighting caller wants the range, and recovering one from the
other means a fresh O(n) char→byte walk per sentence.
Fields§
§text: &'a str§char_range: Range<usize>Trait Implementations§
impl<'a> Eq for Sentence<'a>
impl<'a> StructuralPartialEq for Sentence<'a>
Auto Trait Implementations§
impl<'a> Freeze for Sentence<'a>
impl<'a> RefUnwindSafe for Sentence<'a>
impl<'a> Send for Sentence<'a>
impl<'a> Sync for Sentence<'a>
impl<'a> Unpin for Sentence<'a>
impl<'a> UnsafeUnpin for Sentence<'a>
impl<'a> UnwindSafe for Sentence<'a>
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,
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
Compare self to
key and return true if they are equal.