Enum svgtypes::Paint [−][src]
pub enum Paint<'a> {
None,
Inherit,
CurrentColor,
Color(Color),
FuncIRI(&'a str, Option<PaintFallback>),
}Representation of the <paint> type.
Doesn't own the data. Use only for parsing.
<icccolor> isn't supported.
Examples
use svgtypes::{Paint, PaintFallback, Color}; let paint = Paint::from_str("url(#gradient) red").unwrap(); assert_eq!(paint, Paint::FuncIRI("gradient", Some(PaintFallback::Color(Color::red())))); let paint = Paint::from_str("inherit").unwrap(); assert_eq!(paint, Paint::Inherit);
Variants
NoneThe none value.
InheritThe inherit value.
CurrentColorThe currentColor value.
Color(Color)<color> value.
FuncIRI(&'a str, Option<PaintFallback>)<FuncIRI> value with an optional fallback.
Methods
impl<'a> Paint<'a>[src]
impl<'a> Paint<'a>pub fn from_str(s: &'a str) -> Result<Paint<'a>, Error>[src]
pub fn from_str(s: &'a str) -> Result<Paint<'a>, Error>Parsers a Paint from a &str.
We can't use the FromStr trait because it requires
an owned value as a return type.
pub fn from_span(span: StrSpan<'a>) -> Result<Self, Error>[src]
pub fn from_span(span: StrSpan<'a>) -> Result<Self, Error>Parsers a Paint from a StrSpan.
We can't use the FromSpan trait because it requires
an owned value as a return type.
Trait Implementations
impl<'a> Clone for Paint<'a>[src]
impl<'a> Clone for Paint<'a>fn clone(&self) -> Paint<'a>[src]
fn clone(&self) -> Paint<'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)1.0.0
[src]Performs copy-assignment from source. Read more
impl<'a> Copy for Paint<'a>[src]
impl<'a> Copy for Paint<'a>impl<'a> PartialEq for Paint<'a>[src]
impl<'a> PartialEq for Paint<'a>fn eq(&self, other: &Paint<'a>) -> bool[src]
fn eq(&self, other: &Paint<'a>) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Paint<'a>) -> bool[src]
fn ne(&self, other: &Paint<'a>) -> boolThis method tests for !=.
impl<'a> Debug for Paint<'a>[src]
impl<'a> Debug for Paint<'a>