[go: up one dir, main page]

Enum svgtypes::Paint[][src]

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

The none value.

The inherit value.

The currentColor value.

<color> value.

<FuncIRI> value with an optional fallback.

Methods

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

Parsers a Paint from a &str.

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

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

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

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