pub struct TextUnit(/* private fields */);Expand description
An offset into text.
Offset is represented as u32 storing number of utf8-bytes,
but most of the clients should treat it like opaque measure.
Implementations§
Source§impl TextUnit
 
impl TextUnit
Sourcepub fn of_str(s: &str) -> TextUnit
 
pub fn of_str(s: &str) -> TextUnit
TextUnit equal to the length of this string.
§Panics
Panics if the length of the string is greater than u32::max_value()
pub fn checked_sub(self, other: TextUnit) -> Option<TextUnit>
pub fn from_usize(size: usize) -> TextUnit
pub fn to_usize(self) -> usize
Trait Implementations§
Source§impl<'a> AddAssign<&'a TextUnit> for TextRange
 
impl<'a> AddAssign<&'a TextUnit> for TextRange
Source§fn add_assign(&mut self, rhs: &'a TextUnit)
 
fn add_assign(&mut self, rhs: &'a TextUnit)
Performs the 
+= operation. Read moreSource§impl<'a> AddAssign<&'a TextUnit> for TextUnit
 
impl<'a> AddAssign<&'a TextUnit> for TextUnit
Source§fn add_assign(&mut self, rhs: &'a TextUnit)
 
fn add_assign(&mut self, rhs: &'a TextUnit)
Performs the 
+= operation. Read moreSource§impl AddAssign<TextUnit> for TextRange
 
impl AddAssign<TextUnit> for TextRange
Source§fn add_assign(&mut self, rhs: TextUnit)
 
fn add_assign(&mut self, rhs: TextUnit)
Performs the 
+= operation. Read moreSource§impl AddAssign for TextUnit
 
impl AddAssign for TextUnit
Source§fn add_assign(&mut self, rhs: TextUnit)
 
fn add_assign(&mut self, rhs: TextUnit)
Performs the 
+= operation. Read moreSource§impl Ord for TextUnit
 
impl Ord for TextUnit
Source§impl PartialOrd for TextUnit
 
impl PartialOrd for TextUnit
Source§impl RangeBounds<TextUnit> for TextRange
 
impl RangeBounds<TextUnit> for TextRange
Source§impl<'a> SubAssign<&'a TextUnit> for TextRange
 
impl<'a> SubAssign<&'a TextUnit> for TextRange
Source§fn sub_assign(&mut self, rhs: &'a TextUnit)
 
fn sub_assign(&mut self, rhs: &'a TextUnit)
Performs the 
-= operation. Read moreSource§impl<'a> SubAssign<&'a TextUnit> for TextUnit
 
impl<'a> SubAssign<&'a TextUnit> for TextUnit
Source§fn sub_assign(&mut self, rhs: &'a TextUnit)
 
fn sub_assign(&mut self, rhs: &'a TextUnit)
Performs the 
-= operation. Read moreSource§impl SubAssign<TextUnit> for TextRange
 
impl SubAssign<TextUnit> for TextRange
Source§fn sub_assign(&mut self, rhs: TextUnit)
 
fn sub_assign(&mut self, rhs: TextUnit)
Performs the 
-= operation. Read moreSource§impl SubAssign for TextUnit
 
impl SubAssign for TextUnit
Source§fn sub_assign(&mut self, rhs: TextUnit)
 
fn sub_assign(&mut self, rhs: TextUnit)
Performs the 
-= operation. Read moreimpl Copy for TextUnit
impl Eq for TextUnit
impl StructuralPartialEq for TextUnit
Auto Trait Implementations§
impl Freeze for TextUnit
impl RefUnwindSafe for TextUnit
impl Send for TextUnit
impl Sync for TextUnit
impl Unpin for TextUnit
impl UnwindSafe for TextUnit
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