Struct harper_core::Span
source · pub struct Span {
pub start: usize,
pub end: usize,
}
Expand description
A window in a char.
Fields§
§start: usize
§end: usize
Implementations§
source§impl Span
impl Span
pub fn new(start: usize, end: usize) -> Self
pub fn new_with_len(start: usize, len: usize) -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn overlaps_with(&self, other: Self) -> bool
sourcepub fn try_get_content<'a>(&self, source: &'a [char]) -> Option<&'a [char]>
pub fn try_get_content<'a>(&self, source: &'a [char]) -> Option<&'a [char]>
Get the associated content. Will return None
if any aspect is
invalid.
sourcepub fn get_content<'a>(&self, source: &'a [char]) -> &'a [char]
pub fn get_content<'a>(&self, source: &'a [char]) -> &'a [char]
Get the associated content. Will panic if any aspect is invalid.
pub fn get_content_string(&self, source: &[char]) -> String
pub fn set_len(&mut self, length: usize)
pub fn with_len(&self, length: usize) -> Self
pub fn offset(&mut self, by: usize)
Trait Implementations§
source§impl<'de> Deserialize<'de> for Span
impl<'de> Deserialize<'de> for Span
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Span
impl PartialEq for Span
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin 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