Struct jpar::Span [−][src]
A Span is a set of meta information about the location of a substring.
Implementations
impl<'a> Span<'a>
[src]
pub fn whole_content(&self) -> &'a str
[src]
The whole content the Span
belongs to.
pub fn content(&self) -> &'a str
[src]
The content of the Span
.
pub fn content_before(&self) -> &'a str
[src]
The content before the Span
.
pub fn content_after(&self) -> &'a str
[src]
The content after the Span
.
pub fn start_cursor(&self) -> &Cursor
[src]
The start position of the Span
in bytes.
pub fn end_cursor(&self) -> &Cursor
[src]
The end position of the Span
in bytes.
pub fn len(&self) -> usize
[src]
The length of the Span
in bytes.
pub fn is_empty(&self) -> bool
[src]
Whether the span is empty or not.
pub fn char_length(&self) -> usize
[src]
The length of the Span
in characters.
pub fn lines(&self) -> &'a str
[src]
Returns the line(s) in which the Span
is contained.
If it is composed of more than one line, the result will be all the lines.
Example
let mut reader = Reader::new("This\nis\nthe\nfragment"); // ... prepare the span to contain: "his\nis\nt" ... let span = reader.substring(&from_cursor, &to_cursor); // Get its lines. assert_eq!(span.lines(), "This\nis\nthe");
Trait Implementations
impl<'a> Clone for Span<'a>
[src]
impl<'a> Debug for Span<'a>
[src]
impl<'a> Eq for Span<'a>
[src]
impl<'a> PartialEq<Span<'a>> for Span<'a>
[src]
impl<'a> StructuralEq for Span<'a>
[src]
impl<'a> StructuralPartialEq for Span<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Span<'a>
impl<'a> Send for Span<'a>
impl<'a> Sync for Span<'a>
impl<'a> Unpin for Span<'a>
impl<'a> UnwindSafe for Span<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,