Enum lyon::svg::parser::AttributeValue
[−]
[src]
pub enum AttributeValue<'a> {
Color(RgbColor),
EntityRef(&'a [u8]),
Length(Length),
LengthList(LengthList<'a>),
IRI(&'a [u8]),
FuncIRI(&'a [u8]),
FuncIRIWithFallback(&'a [u8], PaintFallback),
Number(f64),
NumberList(NumberList<'a>),
PredefValue(ValueId),
String(&'a [u8]),
}Representation of the SVG attribute value.
Variants
Color(RgbColor)<color> type.
EntityRef(&'a [u8])Reference to the 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.
FuncIRIWithFallback(&'a [u8], PaintFallback)<FuncIRI> type.
Number(f64)<number> type.
NumberList(NumberList<'a>)<list-of-numbers> type.
PredefValue(ValueId)ID of the predefined value.
String(&'a [u8])Unknown data.
Methods
impl<'a> AttributeValue<'a>
fn from_stream(eid: ElementId,
aid: AttributeId,
stream: &mut Stream<'a>)
-> Result<AttributeValue<'a>, Error>
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
Errortypes can occur. - Data of an unknown attribute will be parsed as
AttributeValue::Stringwithout errors.
Notes
<transform>,<path>and<style>values should be parsed using their own tokenizer's. This function will parse them asAttributeValue::String, aka ignores.enable-backgroundandcursorare not fully implemented. This function will try to parse a single predefined value. Other data will be parsed asAttributeValue::String.Library will print a warning to stdout.
viewBoxwill 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.