Enum svgparser::AttributeValue
[−]
[src]
pub enum AttributeValue<'a> { Number(f64), NumberList(NumberList<'a>), Length(Length), LengthList(LengthList<'a>), Color(Color), ViewBox(ViewBox), AspectRatio(AspectRatio), Points(Points<'a>), Path(Tokenizer<'a>), Style(Tokenizer<'a>), Transform(Tokenizer<'a>), EntityRef(&'a str), IRI(&'a str), FuncIRI(&'a str), FuncIRIWithFallback(&'a str, PaintFallback), PredefValue(ValueId), String(&'a str), }
Representation of the SVG attribute value.
Variants
Number(f64)
<number>
type.
NumberList(NumberList<'a>)
<list-of-numbers> type.
Length(Length)
<length>
type.
LengthList(LengthList<'a>)
<list-of-lengths> type.
Color(Color)
<color>
type.
ViewBox(ViewBox)
<viewBox>
type.
AspectRatio(AspectRatio)
Representation of the preserveAspectRatio
attribute.
Points(Points<'a>)
<list-of-points>
type.
Path(Tokenizer<'a>)
<path>
type.
Style(Tokenizer<'a>)
<style>
type.
Transform(Tokenizer<'a>)
<transform-list>
type.
EntityRef(&'a str)
Reference to the ENTITY. Contains only name
from &name;
.
IRI(&'a str)
<IRI>
type.
FuncIRI(&'a str)
<FuncIRI>
type.
FuncIRIWithFallback(&'a str, PaintFallback)
<FuncIRI>
type with a fallback value.
PredefValue(ValueId)
ID of the predefined value.
String(&'a str)
Unknown data.
Methods
impl<'a> AttributeValue<'a>
[src]
pub fn from_span(
eid: ElementId,
prefix: &str,
aid: AttributeId,
span: StrSpan<'a>
) -> Result<AttributeValue<'a>, StreamError>
[src]
eid: ElementId,
prefix: &str,
aid: AttributeId,
span: StrSpan<'a>
) -> Result<AttributeValue<'a>, StreamError>
Parses AttributeValue
from StrSpan
.
This function supports all presentation attributes.
Errors
- Most of the
StreamError
's can occur. - Data of an unknown attribute will be parsed as
AttributeValue::String
without errors.
Notes
enable-background
is not fully implemented. This function will try to parse a single predefined value. Other data will be parsed asAttributeValue::String
.opacity
value will be bounded to 0..1 range.- This function didn't correct most of the numeric values.
Like
rect
's negative size, etc. - If
prefix
is not empty andaid
is notHref
, thenAttributeValue::String
will be removed.
pub fn from_str(
eid: ElementId,
prefix: &str,
aid: AttributeId,
text: &'a str
) -> Result<AttributeValue<'a>, StreamError>
[src]
eid: ElementId,
prefix: &str,
aid: AttributeId,
text: &'a str
) -> Result<AttributeValue<'a>, StreamError>
Parses AttributeValue
from string.
The same as from_frame
.
Trait Implementations
impl<'a> Debug for AttributeValue<'a>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a> Clone for AttributeValue<'a>
[src]
fn clone(&self) -> AttributeValue<'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 AttributeValue<'a>
[src]
impl<'a> PartialEq for AttributeValue<'a>
[src]
fn eq(&self, __arg_0: &AttributeValue<'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: &AttributeValue<'a>) -> bool
[src]
This method tests for !=
.