Debian Codegraph @

src/node/element/tag.rs

raw symbols SCIP
1 //! The tags.
2
3 #![allow(non_upper_case_globals)]
4
5 use craterust-analyzer cargo svg 0.18.0 crate/::noderust-analyzer cargo svg 0.18.0 node/::Attributesrust-analyzer cargo svg 0.18.0 node/Attributes#;
6 use craterust-analyzer cargo svg 0.18.0 crate/::parserrust-analyzer cargo svg 0.18.0 parser/::{Errorrust-analyzer cargo svg 0.18.0 parser/error/Error#, Readerrust-analyzer cargo svg 0.18.0 parser/reader/Reader#, Resultrust-analyzer cargo svg 0.18.0 parser/Result#};
7
8 /// A tag.
9 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
10 pub struct Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#<'l>(pub &'l str, pub Typerust-analyzer cargo svg 0.18.0 node/element/tag/Type#, pub Attributesrust-analyzer cargo svg 0.18.0 node/Attributes#);
11
12 /// A [type][1] of a tag.
13 ///
14 /// [1]: http://www.w3.org/TR/REC-xml/#sec-starttags
15 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
16 pub enum Typerust-analyzer cargo svg 0.18.0 node/element/tag/Type# {
17 /// A start tag.
18 Startrust-analyzer cargo svg 0.18.0 node/element/tag/Type#Start#,
19 /// An end tag.
20 Endrust-analyzer cargo svg 0.18.0 node/element/tag/Type#End#,
21 /// An empty tag.
22 Emptyrust-analyzer cargo svg 0.18.0 node/element/tag/Type#Empty#,
23 }
24
25 struct Parserrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#<'l> {
26 readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader.: Readerrust-analyzer cargo svg 0.18.0 parser/reader/Reader#<'l>,
27 }
28
29 impl<'l> Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#<'l> {
30 /// Parse a tag.
31 #[inline]
32 pub fn parserust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Tag<'l>`]parse().(content: &'l str) -> Resultrust-analyzer cargo svg 0.18.0 parser/Result#<Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#<'l>> {
33 Parserrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#::newrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]new().(content).processrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]process().()
34 }
35 }
36
37 macro_rules! raiserust-analyzer cargo svg 0.18.0 node/element/tag/raise!(
38 ($parser:expr, $($argument:tt)*) => (
39 return Err(Error::new($parser.reader.position(), format!($($argument)*)))
40 );
41 );
42
43 impl<'l> Parserrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#<'l> {
44 #[inline]
45 fn newrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]new().(content: &'l str) -> Selfrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`] {
46 Parserrust-analyzer cargo svg 0.18.0 node/element/tag/Parser# {
47 readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader.: Readerrust-analyzer cargo svg 0.18.0 parser/reader/Reader#::newrust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]new().(content),
48 }
49 }
50
51 fn processrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]process().(&mut self) -> Resultrust-analyzer cargo svg 0.18.0 parser/Result#<Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#<'l>> {
52 if self.readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader..consume_charrust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]consume_char().('/') {
53 self.read_end_tagrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_end_tag().()
54 } else {
55 self.read_start_or_empty_tagrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_start_or_empty_tag().()
56 }
57 }
58
59 fn read_attributerust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_attribute().(&mut self) -> Resultrust-analyzer cargo svg 0.18.0 parser/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#)>> {
60 let attribute = self
61 .readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader.
62 .capturerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]capture().(|reader| reader.consume_attributerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]consume_attribute().())
63 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().);
64 match attribute {
65 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(attribute) => {
66 let k = attribute.findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().('=').unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
67 let name = attribute[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#k]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()..trim_endrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_end().();
68 let value = attribute[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().(k rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1)..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()..trim_startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_start().();
69 let value = &value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#(value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1)]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
70 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(name), Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().(value))))
71 }
72 _ => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#),
73 }
74 }
75
76 fn read_attributesrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_attributes().(&mut self) -> Resultrust-analyzer cargo svg 0.18.0 parser/Result#<Attributesrust-analyzer cargo svg 0.18.0 node/Attributes#> {
77 let mut attributes = Attributesrust-analyzer cargo svg 0.18.0 node/Attributes#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().();
78 loop {
79 self.readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader..consume_whitespacerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]consume_whitespace().();
80 match self.read_attributerust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_attribute().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
81 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((name, value)) => {
82 attributes.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(name, value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
83 }
84 _ => break,
85 }
86 }
87 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(attributes)
88 }
89
90 fn read_end_tagrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_end_tag().(&mut self) -> Resultrust-analyzer cargo svg 0.18.0 parser/Result#<Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#<'l>> {
91 let name = self.read_namerust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_name().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
92 self.readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader..consume_whitespacerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]consume_whitespace().();
93 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader..is_donerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]is_done().() {
94 raiserust-analyzer cargo svg 0.18.0 node/element/tag/raise!!(self, "found an end tag with excessive data");
95 }
96 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#(name, Typerust-analyzer cargo svg 0.18.0 node/element/tag/Type#::Endrust-analyzer cargo svg 0.18.0 node/element/tag/Type#End#, Attributesrust-analyzer cargo svg 0.18.0 node/Attributes#::defaultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S>`][Default]default().()))
97 }
98
99 fn read_namerust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_name().(&mut self) -> Resultrust-analyzer cargo svg 0.18.0 parser/Result#<&'l str> {
100 let name = self.readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader..capturerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]capture().(|reader| reader.consume_namerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]consume_name().());
101 match name {
102 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(name) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(name),
103 _ => raiserust-analyzer cargo svg 0.18.0 node/element/tag/raise!!(self, "expected a name"),
104 }
105 }
106
107 fn read_start_or_empty_tagrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_start_or_empty_tag().(&mut self) -> Resultrust-analyzer cargo svg 0.18.0 parser/Result#<Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#<'l>> {
108 let name = self.read_namerust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_name().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
109 let attributes = self.read_attributesrust-analyzer cargo svg 0.18.0 node/element/tag/impl#[`Parser<'l>`]read_attributes().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
110 self.readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader..consume_whitespacerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]consume_whitespace().();
111 let tail = self.readerrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#reader..capturerust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]capture().(|reader| reader.consume_allrust-analyzer cargo svg 0.18.0 parser/reader/impl#[`Reader<'l>`]consume_all().());
112 match tail {
113 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("/") => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#(name, Typerust-analyzer cargo svg 0.18.0 node/element/tag/Type#::Emptyrust-analyzer cargo svg 0.18.0 node/element/tag/Type#Empty#, attributes)),
114 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(_) => raiserust-analyzer cargo svg 0.18.0 node/element/tag/raise!!(self, "found an unexpected ending of a tag"),
115 _ => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#(name, Typerust-analyzer cargo svg 0.18.0 node/element/tag/Type#::Startrust-analyzer cargo svg 0.18.0 node/element/tag/Type#Start#, attributes)),
116 }
117 }
118 }
119
120 macro_rules! implementrust-analyzer cargo svg 0.18.0 node/element/tag/implement! {
121 ($($const_name:ident: $tag_name:expr,)*) => ($(
122 #[doc = $tag_name]
123 pub const $const_name: &'static str = $tag_name;
124 )*);
125 }
126
127 implementrust-analyzer cargo svg 0.18.0 node/element/tag/implement!! {
128 Anchorrust-analyzer cargo svg 0.18.0 node/element/tag/Anchor.: "a",
129 Animaterust-analyzer cargo svg 0.18.0 node/element/tag/Animate.: "animate",
130 AnimateColorrust-analyzer cargo svg 0.18.0 node/element/tag/AnimateColor.: "animateColor",
131 AnimateMotionrust-analyzer cargo svg 0.18.0 node/element/tag/AnimateMotion.: "animateMotion",
132 AnimateTransformrust-analyzer cargo svg 0.18.0 node/element/tag/AnimateTransform.: "animateTransform",
133 Circlerust-analyzer cargo svg 0.18.0 node/element/tag/Circle.: "circle",
134 ClipPathrust-analyzer cargo svg 0.18.0 node/element/tag/ClipPath.: "clipPath",
135 Definitionsrust-analyzer cargo svg 0.18.0 node/element/tag/Definitions.: "defs",
136 Descriptionrust-analyzer cargo svg 0.18.0 node/element/tag/Description.: "desc",
137 Ellipserust-analyzer cargo svg 0.18.0 node/element/tag/Ellipse.: "ellipse",
138 Filterrust-analyzer cargo svg 0.18.0 node/element/tag/Filter.: "filter",
139 FilterEffectBlendrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectBlend.: "feBlend",
140 FilterEffectColorMatrixrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectColorMatrix.: "feColorMatrix",
141 FilterEffectComponentTransferrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectComponentTransfer.: "feComponentTransfer",
142 FilterEffectCompositerust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectComposite.: "feComposite",
143 FilterEffectConvolveMatrixrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectConvolveMatrix.: "feConvolveMatrix",
144 FilterEffectDiffuseLightingrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectDiffuseLighting.: "feDiffuseLighting",
145 FilterEffectDisplacementMaprust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectDisplacementMap.: "feDisplacementMap",
146 FilterEffectDistantLightrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectDistantLight.: "feDistantLight",
147 FilterEffectDropShadowrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectDropShadow.: "feDropShadow",
148 FilterEffectFloodrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectFlood.: "feFlood",
149 FilterEffectFunctionArust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectFunctionA.: "feFuncA",
150 FilterEffectFunctionBrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectFunctionB.: "feFuncB",
151 FilterEffectFunctionGrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectFunctionG.: "feFuncG",
152 FilterEffectFunctionRrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectFunctionR.: "feFuncR",
153 FilterEffectGaussianBlurrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectGaussianBlur.: "feGaussianBlur",
154 FilterEffectImagerust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectImage.: "feImage",
155 FilterEffectMergerust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectMerge.: "feMerge",
156 FilterEffectMergeNoderust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectMergeNode.: "feMergeNode",
157 FilterEffectMorphologyrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectMorphology.: "feMorphology",
158 FilterEffectOffsetrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectOffset.: "feOffset",
159 FilterEffectPointLightrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectPointLight.: "fePointLight",
160 FilterEffectSpecularLightingrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectSpecularLighting.: "feSpecularLighting",
161 FilterEffectSpotLightrust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectSpotLight.: "feSpotLight",
162 FilterEffectTilerust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectTile.: "feTile",
163 FilterEffectTurbulencerust-analyzer cargo svg 0.18.0 node/element/tag/FilterEffectTurbulence.: "feTurbulence",
164 ForeignObjectrust-analyzer cargo svg 0.18.0 node/element/tag/ForeignObject.: "foreignObject",
165 Grouprust-analyzer cargo svg 0.18.0 node/element/tag/Group.: "g",
166 Imagerust-analyzer cargo svg 0.18.0 node/element/tag/Image.: "image",
167 Linerust-analyzer cargo svg 0.18.0 node/element/tag/Line.: "line",
168 LinearGradientrust-analyzer cargo svg 0.18.0 node/element/tag/LinearGradient.: "linearGradient",
169 Linkrust-analyzer cargo svg 0.18.0 node/element/tag/Link.: "link",
170 Markerrust-analyzer cargo svg 0.18.0 node/element/tag/Marker.: "marker",
171 Maskrust-analyzer cargo svg 0.18.0 node/element/tag/Mask.: "mask",
172 MotionPathrust-analyzer cargo svg 0.18.0 node/element/tag/MotionPath.: "mpath",
173 Pathrust-analyzer cargo svg 0.18.0 node/element/tag/Path.: "path",
174 Patternrust-analyzer cargo svg 0.18.0 node/element/tag/Pattern.: "pattern",
175 Polygonrust-analyzer cargo svg 0.18.0 node/element/tag/Polygon.: "polygon",
176 Polylinerust-analyzer cargo svg 0.18.0 node/element/tag/Polyline.: "polyline",
177 RadialGradientrust-analyzer cargo svg 0.18.0 node/element/tag/RadialGradient.: "radialGradient",
178 Rectanglerust-analyzer cargo svg 0.18.0 node/element/tag/Rectangle.: "rect",
179 Scriptrust-analyzer cargo svg 0.18.0 node/element/tag/Script.: "script",
180 Stoprust-analyzer cargo svg 0.18.0 node/element/tag/Stop.: "stop",
181 Stylerust-analyzer cargo svg 0.18.0 node/element/tag/Style.: "style",
182 SVGrust-analyzer cargo svg 0.18.0 node/element/tag/SVG.: "svg",
183 Symbolrust-analyzer cargo svg 0.18.0 node/element/tag/Symbol.: "symbol",
184 Textrust-analyzer cargo svg 0.18.0 node/element/tag/Text.: "text",
185 TextPathrust-analyzer cargo svg 0.18.0 node/element/tag/TextPath.: "textPath",
186 Titlerust-analyzer cargo svg 0.18.0 node/element/tag/Title.: "title",
187 TSpanrust-analyzer cargo svg 0.18.0 node/element/tag/TSpan.: "tspan",
188 Userust-analyzer cargo svg 0.18.0 node/element/tag/Use.: "use",
189 }
190
191 #[cfg(test)]
192 mod testsrust-analyzer cargo svg 0.18.0 node/element/tag/tests/ {
193 use superrust-analyzer cargo svg 0.18.0 node/element/tag/::{Parserrust-analyzer cargo svg 0.18.0 node/element/tag/Parser#, Tagrust-analyzer cargo svg 0.18.0 node/element/tag/Tag#, Typerust-analyzer cargo svg 0.18.0 node/element/tag/Type#};
194
195 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
196 fn parser_processrust-analyzer cargo svg 0.18.0 node/element/tag/tests/parser_process().() {
197 macro_rules! testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!(
198 ($content:expr, $kind:ident) => ({
199 let mut parser = Parser::new($content);
200 match parser.process().unwrap() {
201 Tag("foo", Type::$kind, _) => {}
202 _ => unreachable!(),
203 }
204 });
205 );
206
207 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo", Startrust-analyzer cargo svg 0.18.0 node/element/tag/Type#Start#);
208 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo ", Startrust-analyzer cargo svg 0.18.0 node/element/tag/Type#Start#);
209 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("/foo", Endrust-analyzer cargo svg 0.18.0 node/element/tag/Type#End#);
210 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("/foo ", Endrust-analyzer cargo svg 0.18.0 node/element/tag/Type#End#);
211 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo/", Emptyrust-analyzer cargo svg 0.18.0 node/element/tag/Type#Empty#);
212 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo /", Emptyrust-analyzer cargo svg 0.18.0 node/element/tag/Type#Empty#);
213 }
214
215 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
216 fn parser_read_attributerust-analyzer cargo svg 0.18.0 node/element/tag/tests/parser_read_attribute().() {
217 macro_rules! testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!(
218 ($content:expr, $name:expr, $value:expr) => ({
219 let mut parser = Parser::new($content);
220 let (name, value) = parser.read_attribute().unwrap().unwrap();
221 assert_eq!(&*name, $name);
222 assert_eq!(&*value, $value);
223 });
224 );
225
226 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo=''", "foo", "");
227 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo='bar'", "foo", "bar");
228 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo =\"bar\"", "foo", "bar");
229 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo= \"bar\"", "foo", "bar");
230 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("foo\t=\n'bar' ", "foo", "bar");
231 testrust-analyzer cargo svg 0.18.0 node/element/tag/tests/test!!("標籤='數值'", "標籤", "數值");
232 }
233 }