[][src]Enum svgtypes::Paint

pub enum Paint<'a> {
    None,
    Inherit,
    CurrentColor,
    Color(Color),
    FuncIRI(&'a strOption<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

None

The none value.

Inherit

The inherit value.

CurrentColor

The currentColor value.

Color(Color)

<color> value.

FuncIRI(&'a strOption<PaintFallback>)

<FuncIRI> value with an optional fallback.

Methods

impl<'a> Paint<'a>[src]

pub fn from_str(text: &'a str) -> Result<Self, Error>[src]

Parsers a Paint from a StrSpan.

We can't use the FromStr trait because it requires an owned value as a return type.

Trait Implementations

impl<'a> Clone for Paint<'a>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'a> PartialEq<Paint<'a>> for Paint<'a>[src]

impl<'a> Copy for Paint<'a>[src]

impl<'a> Debug for Paint<'a>[src]

Auto Trait Implementations

impl<'a> Sync for Paint<'a>

impl<'a> Send for Paint<'a>

impl<'a> Unpin for Paint<'a>

impl<'a> RefUnwindSafe for Paint<'a>

impl<'a> UnwindSafe for Paint<'a>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]