pub struct Span {
pub start: usize,
pub end: usize,
pub style: Style,
}Expand description
A marked-up region in some text.
Fields§
§start: usize§end: usize§style: StyleImplementations§
Source§impl Span
impl Span
pub fn new(start: usize, end: usize, style: Style) -> Self
Sourcepub fn split(&self, offset: usize) -> (Self, Option<Self>)
pub fn split(&self, offset: usize) -> (Self, Option<Self>)
Split a span at the given offset, producing two spans. The first covers [start, offset), the second [offset, end).
Sourcepub fn right_crop(&self, offset: usize) -> Self
pub fn right_crop(&self, offset: usize) -> Self
Crop the span end to not exceed offset.
Trait Implementations§
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
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