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::new(255, 0, 0))))); 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]
pub fn from_str(s: &'a str) -> Result<Paint<'a>, Error>[src]
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]
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]
fn clone(&self) -> Paint<'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
impl<'a> Copy for Paint<'a>[src]
impl<'a> PartialEq for Paint<'a>[src]
fn eq(&self, __arg_0: &Paint<'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: &Paint<'a>) -> bool[src]
This method tests for !=.