Enum svgparser::AttributeValue
[−]
[src]
pub enum AttributeValue<'a> { Color(RgbColor), EntityRef(&'a [u8]), Length(Length), LengthList(LengthList<'a>), IRI(&'a [u8]), FuncIRI(&'a [u8]), Number(f64), NumberList(NumberList<'a>), PredefValue(ValueId), String(&'a [u8]), }
Representation of SVG attribute value.
Variants
Color(RgbColor)
<color> type.
EntityRef(&'a [u8])
Reference to ENTITY. Contains only name
from &name;
.
Length(Length)
<length> type.
LengthList(LengthList<'a>)
<list-of-lengths> type.
IRI(&'a [u8])
<IRI> type.
FuncIRI(&'a [u8])
<FuncIRI> type.
Number(f64)
<number> type.
NumberList(NumberList<'a>)
<list-of-numbers> type.
PredefValue(ValueId)
ID of predefined value.
String(&'a [u8])
Unknown data.
Methods
impl<'a> AttributeValue<'a>
[src]
fn from_stream(eid: ElementId, aid: AttributeId, stream: &mut Stream<'a>) -> Result<AttributeValue<'a>, Error>
Converts stream data into AttributeValue
.
This function supports all presentation attributes.
Errors
- Most of the
Error
types can occur. - Data of unknown attribute will be parsed as
AttributeValue::String
, without errors. - Fallback color for
<paint>
type is not supported. It will be skipped. Example:fill="#linearGradient1 #f00"
.
Notes
<transform>
,<path>
and<style>
values should be parsed using their own tokenizer's. This function will parse them asAttributeValue::String
, aka ignores.enable-background
andcursor
not fully implemented. This function will try to parse a single predefined value. Other data will be parsed asAttributeValue::String
.Library will print warning to stdout.
viewBox
will be parsed asAttributeValue::NumberList
.<opacity>
value will be bounded to 0..1 range.This function didn't correct most of the numeric values. If value has an incorrect data, like
viewBox='0 0 -1 -5'
(negative w/h is error), it will be parsed as is.
Trait Implementations
impl<'a> Clone for AttributeValue<'a>
[src]
fn clone(&self) -> AttributeValue<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> PartialEq for AttributeValue<'a>
[src]
fn eq(&self, __arg_0: &AttributeValue<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &AttributeValue<'a>) -> bool
This method tests for !=
.