Struct xmlparser::StrSpan
[−]
[src]
#[must_use]pub struct StrSpan<'a> { /* fields omitted */ }
An immutable string slice.
Unlike &str
contains a reference to the original string
and a span position.
Methods
impl<'a> StrSpan<'a>
[src]
fn from_str(text: &str) -> StrSpan
[src]
Constructs a new StrSpan
from string.
fn from_substr(text: &str, start: usize, end: usize) -> StrSpan
[src]
Constructs a new StrSpan
from substring.
fn start(&self) -> usize
[src]
Returns a start position of the span.
fn end(&self) -> usize
[src]
Returns a end position of the span.
fn len(&self) -> usize
[src]
Returns a length of the span.
fn is_empty(&self) -> bool
[src]
Returns a length of the span.
fn full_len(&self) -> usize
[src]
Returns a length of the span underling string.
fn to_str(&self) -> &'a str
[src]
Returns a span slice.
A bit expensive, since Rust checks for char boundary.
fn as_bytes(&self) -> &'a [u8]
[src]
Returns a span slice as bytes.
The same as to_str
but does not involve char boundary checking.
fn slice_region(&self, start: usize, end: usize) -> StrSpan<'a>
[src]
Returns an underling string region as StrSpan
.
fn full_str(&self) -> &'a str
[src]
Returns an underling string.
fn trim(&self) -> StrSpan<'a>
[src]
Returns a trimmed version of this StrSpan
.
This function will trim escaped spaces (aka  
) too.
Trait Implementations
impl<'a> PartialEq for StrSpan<'a>
[src]
fn eq(&self, __arg_0: &StrSpan<'a>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &StrSpan<'a>) -> bool
[src]
This method tests for !=
.
impl<'a> Clone for StrSpan<'a>
[src]
fn clone(&self) -> StrSpan<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more