Struct svgdom::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]
impl<'a> StrSpan<'a>
pub fn from_substr(text: &str, start: usize, end: usize) -> StrSpan
[src]
pub fn from_substr(text: &str, start: usize, end: usize) -> StrSpan
Constructs a new StrSpan
from substring.
pub fn start(&self) -> usize
[src]
pub fn start(&self) -> usize
Returns a start position of the span.
pub fn end(&self) -> usize
[src]
pub fn end(&self) -> usize
Returns a end position of the span.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns a length of the span.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns a length of the span.
pub fn full_len(&self) -> usize
[src]
pub fn full_len(&self) -> usize
Returns a length of the span underling string.
pub fn to_str(&self) -> &'a str
[src]
pub fn to_str(&self) -> &'a str
Returns a span slice.
A bit expensive, since Rust checks for char boundary.
pub fn as_bytes(&self) -> &'a [u8]
[src]
pub fn as_bytes(&self) -> &'a [u8]
Returns a span slice as bytes.
The same as to_str
but does not involve char boundary checking.
pub fn slice_region(&self, start: usize, end: usize) -> StrSpan<'a>
[src]
pub fn slice_region(&self, start: usize, end: usize) -> StrSpan<'a>
Returns an underling string region as StrSpan
.
pub fn full_str(&self) -> &'a str
[src]
pub fn full_str(&self) -> &'a str
Returns an underling string.
pub fn trim(&self) -> StrSpan<'a>
[src]
pub fn trim(&self) -> StrSpan<'a>
Returns a trimmed version of this StrSpan
.
Removes only leading and trailing spaces.
This function will trim escaped spaces (aka  
) too.
Trait Implementations
impl<'a> From<StrSpan<'a>> for PathParser<'a>
[src]
impl<'a> From<StrSpan<'a>> for PathParser<'a>
ⓘImportant traits for PathParser<'a>fn from(span: StrSpan<'a>) -> PathParser<'a>
[src]
fn from(span: StrSpan<'a>) -> PathParser<'a>
Performs the conversion.
impl<'a> From<StrSpan<'a>> for TransformListParser<'a>
[src]
impl<'a> From<StrSpan<'a>> for TransformListParser<'a>
ⓘImportant traits for TransformListParser<'a>fn from(span: StrSpan<'a>) -> TransformListParser<'a>
[src]
fn from(span: StrSpan<'a>) -> TransformListParser<'a>
Performs the conversion.
impl<'a> From<StrSpan<'a>> for PointsParser<'a>
[src]
impl<'a> From<StrSpan<'a>> for PointsParser<'a>
ⓘImportant traits for PointsParser<'a>fn from(span: StrSpan<'a>) -> PointsParser<'a>
[src]
fn from(span: StrSpan<'a>) -> PointsParser<'a>
Performs the conversion.
impl<'a> From<StrSpan<'a>> for LengthListParser<'a>
[src]
impl<'a> From<StrSpan<'a>> for LengthListParser<'a>
ⓘImportant traits for LengthListParser<'a>fn from(span: StrSpan<'a>) -> LengthListParser<'a>
[src]
fn from(span: StrSpan<'a>) -> LengthListParser<'a>
Performs the conversion.
impl<'a> From<StrSpan<'a>> for StyleParser<'a>
[src]
impl<'a> From<StrSpan<'a>> for StyleParser<'a>
ⓘImportant traits for StyleParser<'a>fn from(span: StrSpan<'a>) -> StyleParser<'a>
[src]
fn from(span: StrSpan<'a>) -> StyleParser<'a>
Performs the conversion.
impl<'a> From<StrSpan<'a>> for NumberListParser<'a>
[src]
impl<'a> From<StrSpan<'a>> for NumberListParser<'a>
ⓘImportant traits for NumberListParser<'a>fn from(span: StrSpan<'a>) -> NumberListParser<'a>
[src]
fn from(span: StrSpan<'a>) -> NumberListParser<'a>
Performs the conversion.
impl<'a> Clone for StrSpan<'a>
[src]
impl<'a> Clone for StrSpan<'a>
fn clone(&self) -> StrSpan<'a>
[src]
fn clone(&self) -> StrSpan<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a> Display for StrSpan<'a>
[src]
impl<'a> Display for StrSpan<'a>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'a> Debug for StrSpan<'a>
[src]
impl<'a> Debug for StrSpan<'a>
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'a> Copy for StrSpan<'a>
[src]
impl<'a> Copy for StrSpan<'a>
impl<'a> PartialEq<StrSpan<'a>> for StrSpan<'a>
[src]
impl<'a> PartialEq<StrSpan<'a>> for StrSpan<'a>
fn eq(&self, other: &StrSpan<'a>) -> bool
[src]
fn eq(&self, other: &StrSpan<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &StrSpan<'a>) -> bool
[src]
fn ne(&self, other: &StrSpan<'a>) -> bool
This method tests for !=
.
impl<'a> From<StrSpan<'a>> for Stream<'a>
[src]
impl<'a> From<StrSpan<'a>> for Stream<'a>
impl<'a> From<StrSpan<'a>> for Tokenizer<'a>
[src]
impl<'a> From<StrSpan<'a>> for Tokenizer<'a>
ⓘImportant traits for Tokenizer<'a>fn from(span: StrSpan<'a>) -> Tokenizer<'a>
[src]
fn from(span: StrSpan<'a>) -> Tokenizer<'a>
Performs the conversion.
impl<'a> From<&'a str> for StrSpan<'a>
[src]
impl<'a> From<&'a str> for StrSpan<'a>