Debian Codegraph @

src/reader/parser.rs

raw symbols SCIP
1 //! Contains an implementation of pull-based XML parser.
2
3 use craterust-analyzer cargo xml-rs 0.8.19 crate/::commonrust-analyzer cargo xml-rs 0.8.19 common/::{is_xml10_charrust-analyzer cargo xml-rs 0.8.19 common/is_xml10_char()., is_xml11_charrust-analyzer cargo xml-rs 0.8.19 common/is_xml11_char()., is_xml11_char_not_restrictedrust-analyzer cargo xml-rs 0.8.19 common/is_xml11_char_not_restricted()., is_name_charrust-analyzer cargo xml-rs 0.8.19 common/is_name_char()., is_name_start_charrust-analyzer cargo xml-rs 0.8.19 common/is_name_start_char()., is_whitespace_charrust-analyzer cargo xml-rs 0.8.19 common/is_whitespace_char().};
4 use craterust-analyzer cargo xml-rs 0.8.19 crate/::commonrust-analyzer cargo xml-rs 0.8.19 common/::{Positionrust-analyzer cargo xml-rs 0.8.19 common/Position#, TextPositionrust-analyzer cargo xml-rs 0.8.19 common/TextPosition#, XmlVersionrust-analyzer cargo xml-rs 0.8.19 common/XmlVersion#};
5 use craterust-analyzer cargo xml-rs 0.8.19 crate/::namerust-analyzer cargo xml-rs 0.8.19 name/::OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#;
6 use craterust-analyzer cargo xml-rs 0.8.19 crate/::namespacerust-analyzer cargo xml-rs 0.8.19 namespace/::NamespaceStackrust-analyzer cargo xml-rs 0.8.19 namespace/NamespaceStack#;
7 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::configrust-analyzer cargo xml-rs 0.8.19 reader/config/::ParserConfig2rust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#;
8 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::errorrust-analyzer cargo xml-rs 0.8.19 reader/error/::SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#;
9 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::eventsrust-analyzer cargo xml-rs 0.8.19 reader/events/::XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#;
10 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::indexsetrust-analyzer cargo xml-rs 0.8.19 reader/indexset/::AttributesSetrust-analyzer cargo xml-rs 0.8.19 reader/indexset/AttributesSet#;
11 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::lexerrust-analyzer cargo xml-rs 0.8.19 reader/lexer/::{Lexerrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Lexer#, Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#};
12 use superrust-analyzer cargo xml-rs 0.8.19 reader/::{Errorrust-analyzer cargo xml-rs 0.8.19 reader/error/Error#, ErrorKindrust-analyzer cargo xml-rs 0.8.19 reader/error/ErrorKind#};
13
14 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#;
15 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#;
16
17 macro_rules! gen_takesrust-analyzer cargo xml-rs 0.8.19 reader/parser/gen_takes!(
18 ($($field:ident -> $method:ident, $t:ty, $def:expr);+) => (
19 $(
20 impl MarkupData {
21 #[inline]
22 #[allow(clippy::mem_replace_option_with_none)]
23 fn $method(&mut self) -> $t {
24 std::mem::replace(&mut self.$field, $def)
25 }
26 }
27 )+
28 )
29 );
30
31 gen_takesrust-analyzer cargo xml-rs 0.8.19 reader/parser/gen_takes!!(
32 namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#name. -> take_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_name()., 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#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
33 ref_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#ref_data. -> take_ref_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_ref_data()., 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#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
34
35 encodingrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#encoding. -> take_encodingrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_encoding()., 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#>, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
36
37 element_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#element_name. -> take_element_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_element_name()., Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#>, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
38
39 attr_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#attr_name. -> take_attr_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_attr_name()., Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#>, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
40 attributesrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#attributes. -> take_attributesrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_attributes()., AttributesSetrust-analyzer cargo xml-rs 0.8.19 reader/indexset/AttributesSet#, AttributesSetrust-analyzer cargo xml-rs 0.8.19 reader/indexset/AttributesSet#::newrust-analyzer cargo xml-rs 0.8.19 reader/indexset/impl#[AttributesSet]new().()
41 );
42
43 mod inside_cdatarust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_cdata/;
44 mod inside_closing_tag_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_closing_tag_name/;
45 mod inside_commentrust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_comment/;
46 mod inside_declarationrust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_declaration/;
47 mod inside_doctyperust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_doctype/;
48 mod inside_opening_tagrust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_opening_tag/;
49 mod inside_processing_instructionrust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_processing_instruction/;
50 mod inside_referencerust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_reference/;
51 mod outside_tagrust-analyzer cargo xml-rs 0.8.19 reader/parser/outside_tag/;
52
53 static DEFAULT_VERSIONrust-analyzer cargo xml-rs 0.8.19 reader/parser/DEFAULT_VERSION.: XmlVersionrust-analyzer cargo xml-rs 0.8.19 common/XmlVersion# = XmlVersionrust-analyzer cargo xml-rs 0.8.19 common/XmlVersion#::Version10rust-analyzer cargo xml-rs 0.8.19 common/XmlVersion#Version10#;
54 static DEFAULT_STANDALONErust-analyzer cargo xml-rs 0.8.19 reader/parser/DEFAULT_STANDALONE.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool> = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
55
56 type ElementStackrust-analyzer cargo xml-rs 0.8.19 reader/parser/ElementStack# = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#>;
57 pub type Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result# = superrust-analyzer cargo xml-rs 0.8.19 reader/::Resultrust-analyzer cargo xml-rs 0.8.19 reader/Result#<XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#>;
58
59 /// Pull-based XML parser.
60 pub(craterust-analyzer cargo xml-rs 0.8.19 crate/) struct PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser# {
61 configrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#config.: ParserConfig2rust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#,
62 lexerrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#lexer.: Lexerrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Lexer#,
63 strust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#st.: Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#,
64 state_after_referencerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#state_after_reference.: Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#,
65 bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
66
67 /// From DTD internal subset
68 entitiesrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#entities.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<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#>,
69
70 nstrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#nst.: NamespaceStackrust-analyzer cargo xml-rs 0.8.19 namespace/NamespaceStack#,
71
72 datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data.: MarkupDatarust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#,
73 final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#final_result.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#>,
74 next_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#next_event.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#>,
75 estrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#est.: ElementStackrust-analyzer cargo xml-rs 0.8.19 reader/parser/ElementStack#,
76 posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<TextPositionrust-analyzer cargo xml-rs 0.8.19 common/TextPosition#>,
77
78 encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#encountered.: Encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#,
79 inside_whitespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#inside_whitespace.: bool,
80 read_prefix_separatorrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#read_prefix_separator.: bool,
81 pop_namespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pop_namespace.: bool,
82 }
83
84 // Keeps track when XML declaration can happen
85 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:)]
86 enum Encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered# {
87 Nonerust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#None# = 0,
88 AnyCharsrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#AnyChars#, // whitespace before <?xml is not allowed
89 Declarationrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#Declaration#,
90 Commentrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#Comment#,
91 Doctyperust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#Doctype#,
92 Elementrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#Element#,
93 }
94
95 impl PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser# {
96 /// Returns a new parser using the given config.
97 #[inline]
98 pub fn newrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]new().(config: impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<ParserConfig2rust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#>) -> PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser# {
99 let config = config.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().();
100 Selfrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]::new_with_config2rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]new_with_config2().(config)
101 }
102
103 #[inline]
104 fn new_with_config2rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]new_with_config2().(config: ParserConfig2rust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#) -> PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser# {
105 let mut lexer = Lexerrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Lexer#::newrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Lexer]new().(&config);
106 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(enc) = config.override_encodingrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#override_encoding. {
107 lexer.set_encodingrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Lexer]set_encoding().(enc);
108 }
109
110 let mut pos = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(16);
111 pos.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(TextPositionrust-analyzer cargo xml-rs 0.8.19 common/TextPosition#::newrust-analyzer cargo xml-rs 0.8.19 common/impl#[TextPosition]new().());
112
113 PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser# {
114 configrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#config.,
115 lexerrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#lexer.,
116 strust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#st.: Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::DocumentStartrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#DocumentStart#,
117 state_after_referencerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#state_after_reference.: Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::OutsideTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#OutsideTag#,
118 bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
119 entitiesrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#entities.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().(),
120 nstrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#nst.: NamespaceStackrust-analyzer cargo xml-rs 0.8.19 namespace/NamespaceStack#::defaultrust-analyzer cargo xml-rs 0.8.19 namespace/impl#[NamespaceStack]default().(),
121
122 datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data.: MarkupDatarust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData# {
123 namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
124 versionrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#version.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
125 encodingrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#encoding.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
126 standalonerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#standalone.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
127 ref_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#ref_data.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(),
128 element_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#element_name.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
129 quoterust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#quote.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
130 attr_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#attr_name.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
131 attributesrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#attributes.: AttributesSetrust-analyzer cargo xml-rs 0.8.19 reader/indexset/AttributesSet#::newrust-analyzer cargo xml-rs 0.8.19 reader/indexset/impl#[AttributesSet]new().(),
132 },
133 final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#final_result.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
134 next_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#next_event.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
135 estrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#est.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(),
136 posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos.,
137
138 encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#encountered.: Encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#::Nonerust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#None#,
139 inside_whitespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#inside_whitespace.: true,
140 read_prefix_separatorrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#read_prefix_separator.: false,
141 pop_namespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pop_namespace.: false,
142 }
143 }
144
145 /// Checks if this parser ignores the end of stream errors.
146 pub fn is_ignoring_end_of_streamrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]is_ignoring_end_of_stream().(&self) -> bool { self.configrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#config..crust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#c..ignore_end_of_streamrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig#ignore_end_of_stream. }
147
148 #[inline(never)]
149 fn set_encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]set_encountered().(&mut self, new_encounter: Encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
150 if new_encounter rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().self.encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#encountered. {
151 return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
152 }
153 let prev_enc = self.encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#encountered.;
154 self.encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#encountered. = new_encounter;
155
156 // If declaration was not parsed and we have encountered an element,
157 // emit this declaration as the next event.
158 if prev_enc rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[Encountered][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[Encountered][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[Encountered][`PartialEq<Self>`]eq().Encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#::Nonerust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#None# {
159 self.push_posrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]push_pos().();
160 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#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument# {
161 versionrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument#version.: DEFAULT_VERSIONrust-analyzer cargo xml-rs 0.8.19 reader/parser/DEFAULT_VERSION.,
162 encodingrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument#encoding.: self.lexerrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#lexer..encodingrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Lexer]encoding().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(),
163 standalonerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument#standalone.: DEFAULT_STANDALONErust-analyzer cargo xml-rs 0.8.19 reader/parser/DEFAULT_STANDALONE.,
164 }))
165 } else {
166 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
167 }
168 }
169 }
170
171 impl Positionrust-analyzer cargo xml-rs 0.8.19 common/Position# for PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser# {
172 /// Returns the position of the last event produced by the parser
173 #[inline]
174 fn positionrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser][Position]position().(&self) -> TextPositionrust-analyzer cargo xml-rs 0.8.19 common/TextPosition# {
175 self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().
176 }
177 }
178
179 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
180 pub enum Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State# {
181 OutsideTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#OutsideTag#,
182 InsideOpeningTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideOpeningTag#(OpeningTagSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/OpeningTagSubstate#),
183 InsideClosingTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideClosingTag#(ClosingTagSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/ClosingTagSubstate#),
184 InsideProcessingInstructionrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideProcessingInstruction#(ProcessingInstructionSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/ProcessingInstructionSubstate#),
185 InsideCommentrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideComment#,
186 InsideCDatarust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideCData#,
187 InsideDeclarationrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideDeclaration#(DeclarationSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#),
188 InsideDoctyperust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideDoctype#(DoctypeSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#),
189 InsideReferencerust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideReference#,
190 DocumentStartrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#DocumentStart#,
191 }
192
193 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
194 pub enum DoctypeSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate# {
195 Outsiderust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#Outside#,
196 Stringrust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#String#,
197 InsideNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#InsideName#,
198 BeforeEntityNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#BeforeEntityName#,
199 EntityNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#EntityName#,
200 BeforeEntityValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#BeforeEntityValue#,
201 EntityValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#EntityValue#,
202 NumericReferenceStartrust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#NumericReferenceStart#,
203 NumericReferencerust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#NumericReference#,
204 /// expansion
205 PEReferenceInValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#PEReferenceInValue#,
206 PEReferenceInDtdrust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#PEReferenceInDtd#,
207 /// name definition
208 PEReferenceDefinitionStartrust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#PEReferenceDefinitionStart#,
209 PEReferenceDefinitionrust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#PEReferenceDefinition#,
210 SkipDeclarationrust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#SkipDeclaration#,
211 Commentrust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#Comment#,
212 }
213
214 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
215 pub enum OpeningTagSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/OpeningTagSubstate# {
216 InsideNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/OpeningTagSubstate#InsideName#,
217
218 InsideTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/OpeningTagSubstate#InsideTag#,
219
220 InsideAttributeNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/OpeningTagSubstate#InsideAttributeName#,
221 AfterAttributeNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/OpeningTagSubstate#AfterAttributeName#,
222
223 InsideAttributeValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/OpeningTagSubstate#InsideAttributeValue#,
224 AfterAttributeValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/OpeningTagSubstate#AfterAttributeValue#,
225 }
226
227 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
228 pub enum ClosingTagSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/ClosingTagSubstate# {
229 CTInsideNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/ClosingTagSubstate#CTInsideName#,
230 CTAfterNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/ClosingTagSubstate#CTAfterName#,
231 }
232
233 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
234 pub enum ProcessingInstructionSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/ProcessingInstructionSubstate# {
235 PIInsideNamerust-analyzer cargo xml-rs 0.8.19 reader/parser/ProcessingInstructionSubstate#PIInsideName#,
236 PIInsideDatarust-analyzer cargo xml-rs 0.8.19 reader/parser/ProcessingInstructionSubstate#PIInsideData#,
237 }
238
239 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
240 pub enum DeclarationSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate# {
241 BeforeVersionrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#BeforeVersion#,
242 InsideVersionrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#InsideVersion#,
243 AfterVersionrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#AfterVersion#,
244
245 InsideVersionValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#InsideVersionValue#,
246 AfterVersionValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#AfterVersionValue#,
247
248 BeforeEncodingrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#BeforeEncoding#,
249 InsideEncodingrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#InsideEncoding#,
250 AfterEncodingrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#AfterEncoding#,
251
252 InsideEncodingValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#InsideEncodingValue#,
253 AfterEncodingValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#AfterEncodingValue#,
254
255 BeforeStandaloneDeclrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#BeforeStandaloneDecl#,
256 InsideStandaloneDeclrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#InsideStandaloneDecl#,
257 AfterStandaloneDeclrust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#AfterStandaloneDecl#,
258
259 InsideStandaloneDeclValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#InsideStandaloneDeclValue#,
260 AfterStandaloneDeclValuerust-analyzer cargo xml-rs 0.8.19 reader/parser/DeclarationSubstate#AfterStandaloneDeclValue#,
261 }
262
263 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)]
264 enum QualifiedNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget# {
265 AttributeNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#AttributeNameTarget#,
266 OpeningTagNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#OpeningTagNameTarget#,
267 ClosingTagNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#ClosingTagNameTarget#,
268 }
269
270 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
271 enum QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken# {
272 SingleQuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#SingleQuoteToken#,
273 DoubleQuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#DoubleQuoteToken#,
274 }
275
276 impl QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken# {
277 fn from_tokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QuoteToken]from_token().(t: &Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#) -> QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken# {
278 match *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().t {
279 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::SingleQuoterust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#SingleQuote# => QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#::SingleQuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#SingleQuoteToken#,
280 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::DoubleQuoterust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#DoubleQuote# => QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#::DoubleQuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#DoubleQuoteToken#,
281 _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("Unexpected token: {t}"),
282 }
283 }
284
285 fn as_tokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QuoteToken]as_token().(self) -> Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token# {
286 match self {
287 QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#::SingleQuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#SingleQuoteToken# => Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::SingleQuoterust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#SingleQuote#,
288 QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#::DoubleQuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#DoubleQuoteToken# => Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::DoubleQuoterust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#DoubleQuote#,
289 }
290 }
291 }
292
293 struct MarkupDatarust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData# {
294 namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#name.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, // used for processing instruction name
295 ref_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#ref_data.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, // used for reference content
296
297 versionrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#version.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<XmlVersionrust-analyzer cargo xml-rs 0.8.19 common/XmlVersion#>, // used for XML declaration version
298 encodingrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#encoding.: 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#>, // used for XML declaration encoding
299 standalonerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#standalone.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>, // used for XML declaration standalone parameter
300
301 element_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#element_name.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#>, // used for element name
302
303 quoterust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#quote.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#>, // used to hold opening quote for attribute value
304 attr_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#attr_name.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#>, // used to hold attribute name
305 attributesrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#attributes.: AttributesSetrust-analyzer cargo xml-rs 0.8.19 reader/indexset/AttributesSet#, // used to hold all accumulated attributes
306 }
307
308 impl PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser# {
309 /// Returns next event read from the given buffer.
310 ///
311 /// This method should be always called with the same buffer. If you call it
312 /// providing different buffers each time, the result will be undefined.
313 pub fn nextrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]next().<R: Readrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Read#>(&mut self, r: &mut R) -> Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result# {
314 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref ev) = self.final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#final_result. {
315 return ev.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Clone]clone().();
316 }
317
318 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ev) = self.next_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#next_event..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().() {
319 return ev;
320 }
321
322 if self.pop_namespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pop_namespace. {
323 self.pop_namespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pop_namespace. = false;
324 self.nstrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#nst..poprust-analyzer cargo xml-rs 0.8.19 namespace/impl#[NamespaceStack]pop().();
325 }
326
327 loop {
328 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(self.next_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#next_event..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().());
329 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.pop_namespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pop_namespace.);
330
331 // While lexer gives us Ok(maybe_token) -- we loop.
332 // Upon having a complete XML-event -- we return from the whole function.
333 match self.lexerrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#lexer..next_tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Lexer]next_token().(r) {
334 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#(token)) => {
335 match self.dispatch_tokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]dispatch_token().(token) {
336 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {} // continue
337 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#(xml_event)) => {
338 self.next_posrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]next_pos().();
339 return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(xml_event)
340 },
341 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xml_error)) => {
342 self.next_posrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]next_pos().();
343 return self.set_final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]set_final_result().(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(xml_error))
344 },
345 }
346 },
347 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#) => break,
348 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(lexer_error) => {
349 return self.set_final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]set_final_result().(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(lexer_error))
350 },
351 }
352 }
353
354 self.handle_eofrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]handle_eof().()
355 }
356
357 /// Handle end of stream
358 fn handle_eofrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]handle_eof().(&mut self) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#, superrust-analyzer cargo xml-rs 0.8.19 reader/::Errorrust-analyzer cargo xml-rs 0.8.19 reader/error/Error#> {
359 // Forward pos to the lexer head
360 self.next_posrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]next_pos().();
361 let ev = if self.depthrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]depth().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 {
362 if self.encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#encountered. rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[Encountered][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[Encountered][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[Encountered][`PartialEq<Self>`]eq().Encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#::Elementrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#Element# && self.strust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#st. rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[State][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[State][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[State][`PartialEq<Self>`]eq().Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::OutsideTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#OutsideTag# { // all is ok
363 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndDocument#)
364 } else if self.encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#encountered. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().Encounteredrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#::Elementrust-analyzer cargo xml-rs 0.8.19 reader/parser/Encountered#Element# {
365 self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::NoRootElementrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#NoRootElement#)
366 } else { // self.st != State::OutsideTag
367 self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnexpectedEofrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnexpectedEof#) // TODO: add expected hint?
368 }
369 } else if self.configrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#config..crust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#c..ignore_end_of_streamrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig#ignore_end_of_stream. {
370 self.final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#final_result. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
371 self.lexerrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#lexer..reset_eof_handledrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Lexer]reset_eof_handled().();
372 return self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnbalancedRootElementrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnbalancedRootElement#);
373 } else {
374 self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnbalancedRootElementrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnbalancedRootElement#)
375 };
376 self.set_final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]set_final_result().(ev)
377 }
378
379 // This function is to be called when a terminal event is reached.
380 // The function sets up the `self.final_result` into `Some(result)` and return `result`.
381 #[inline]
382 fn set_final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]set_final_result().(&mut self, result: Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#) -> Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result# {
383 self.final_resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#final_result. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(result.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Clone]clone().());
384 result
385 }
386
387 #[cold]
388 fn errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(&self, e: SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#) -> Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result# {
389 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo xml-rs 0.8.19 reader/error/Error# {
390 posrust-analyzer cargo xml-rs 0.8.19 reader/error/Error#pos.: self.lexerrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#lexer..positionrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Lexer][Position]position().(),
391 kindrust-analyzer cargo xml-rs 0.8.19 reader/error/Error#kind.: ErrorKindrust-analyzer cargo xml-rs 0.8.19 reader/error/ErrorKind#::Syntaxrust-analyzer cargo xml-rs 0.8.19 reader/error/ErrorKind#Syntax#(e.to_cowrust-analyzer cargo xml-rs 0.8.19 reader/error/impl#[SyntaxError]to_cow().()),
392 })
393 }
394
395 #[inline]
396 fn next_posrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]next_pos().(&mut self) {
397 // unfortunately calls to next_pos will never be perfectly balanced with push_pos,
398 // at very least because parse errors and EOF can happen unexpectedly without a prior push.
399 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
400 if self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().1 {
401 self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(0);
402 } else {
403 self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos.[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = self.lexerrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#lexer..positionrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Lexer][Position]position().();
404 }
405 }
406 }
407
408 #[inline]
409 #[track_caller]
410 fn push_posrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]push_pos().(&mut self) {
411 debug_assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert!!(self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() != self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]capacity().(), "You've found a bug in xml-rs, caused by calls to push_pos() in states that don't end up emitting events.
412 This case is ignored in release mode, and merely causes document positions to be out of sync.
413 Please file a bug and include the XML document that triggers this assert.");
414
415 // it has capacity preallocated for more than it ever needs, so this reduces code size
416 if self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]capacity().() {
417 self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(self.lexerrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#lexer..positionrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Lexer][Position]position().());
418 } else if self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().1 {
419 self.posrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pos..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]remove().(0); // this mitigates the excessive push_pos() call
420 }
421 }
422
423 #[inline(never)]
424 fn dispatch_tokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]dispatch_token().(&mut self, t: Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
425 match self.strust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#st. {
426 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::OutsideTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#OutsideTag# => self.outside_tagrust-analyzer cargo xml-rs 0.8.19 reader/parser/outside_tag/impl#[PullParser]outside_tag().(t),
427 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideOpeningTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideOpeningTag#(s) => self.inside_opening_tagrust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_opening_tag/impl#[PullParser]inside_opening_tag().(t, s),
428 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideClosingTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideClosingTag#(s) => self.inside_closing_tag_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_closing_tag_name/impl#[PullParser]inside_closing_tag_name().(t, s),
429 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideReferencerust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideReference# => self.inside_referencerust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_reference/impl#[PullParser]inside_reference().(t),
430 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideCommentrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideComment# => self.inside_commentrust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_comment/impl#[PullParser]inside_comment().(t),
431 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideCDatarust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideCData# => self.inside_cdatarust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_cdata/impl#[PullParser]inside_cdata().(t),
432 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideProcessingInstructionrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideProcessingInstruction#(s) => self.inside_processing_instructionrust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_processing_instruction/impl#[PullParser]inside_processing_instruction().(t, s),
433 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideDoctyperust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideDoctype#(s) => self.inside_doctyperust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_doctype/impl#[PullParser]inside_doctype().(t, s),
434 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideDeclarationrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideDeclaration#(s) => self.inside_declarationrust-analyzer cargo xml-rs 0.8.19 reader/parser/inside_declaration/impl#[PullParser]inside_declaration().(t, s),
435 Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::DocumentStartrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#DocumentStart# => self.document_startrust-analyzer cargo xml-rs 0.8.19 reader/parser/outside_tag/impl#[PullParser]document_start().(t),
436 }
437 }
438
439 #[inline]
440 fn depthrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]depth().(&self) -> usize {
441 self.estrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#est..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().()
442 }
443
444 #[inline]
445 fn buf_has_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]buf_has_data().(&self) -> bool {
446 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().()
447 }
448
449 #[inline]
450 fn take_bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]take_buf().(&mut self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
451 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/take().(&mut self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf.)
452 }
453
454 #[inline]
455 fn into_staterust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]into_state().(&mut self, st: Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#, ev: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#>) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
456 self.strust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#st. = st;
457 ev
458 }
459
460 #[inline]
461 fn into_state_continuerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]into_state_continue().(&mut self, st: Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
462 self.into_staterust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]into_state().(st, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#)
463 }
464
465 #[inline]
466 fn into_state_emitrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]into_state_emit().(&mut self, st: Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#, ev: Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
467 self.into_staterust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]into_state().(st, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ev))
468 }
469
470 /// Dispatches tokens in order to process qualified name. If qualified name cannot be parsed,
471 /// an error is returned.
472 ///
473 /// # Parameters
474 /// * `t` --- next token;
475 /// * `on_name` --- a callback which is executed when whitespace is encountered.
476 fn read_qualified_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]read_qualified_name().<F>(&mut self, t: Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#, target: QualifiedNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#, on_name: F) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#>
477 where F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#, Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#, OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
478 // We can get here for the first time only when self.data.name contains zero or one character,
479 // but first character cannot be a colon anyway
480 if self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().1 {
481 self.read_prefix_separatorrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#read_prefix_separator. = false;
482 }
483
484 let invoke_callback = move |this: &mut PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#, t| {
485 let name = this.take_bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]take_buf().();
486 match name.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().() {
487 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(name) => on_name(this, t, name),
488 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(this.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::InvalidQualifiedNamerust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#InvalidQualifiedName#(name.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))),
489 }
490 };
491
492 match t {
493 // There can be only one colon, and not as the first character
494 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::Characterrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#Character#(':') if self.buf_has_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]buf_has_data().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.read_prefix_separatorrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#read_prefix_separator. => {
495 self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(':');
496 self.read_prefix_separatorrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#read_prefix_separator. = true;
497 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
498 }
499
500 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::Characterrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#Character#(c) if c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne().':' && (self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]is_empty().() && is_name_start_charrust-analyzer cargo xml-rs 0.8.19 common/is_name_start_char().(c) ||
501 self.buf_has_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]buf_has_data().() && is_name_charrust-analyzer cargo xml-rs 0.8.19 common/is_name_char().(c)) => {
502 if self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().self.configrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#config..max_name_lengthrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#max_name_length. {
503 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::ExceededConfiguredLimitrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#ExceededConfiguredLimit#));
504 }
505 self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c);
506 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
507 },
508
509 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::EqualsSignrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#EqualsSign# if target rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq().QualifiedNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#::AttributeNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#AttributeNameTarget# => invoke_callback(self, t),
510
511 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::EmptyTagEndrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#EmptyTagEnd# if target rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq().QualifiedNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#::OpeningTagNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#OpeningTagNameTarget# => invoke_callback(self, t),
512
513 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::TagEndrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#TagEnd# if target rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq().QualifiedNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#::OpeningTagNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#OpeningTagNameTarget# ||
514 target rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QualifiedNameTarget][`PartialEq<Self>`]eq().QualifiedNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#::ClosingTagNameTargetrust-analyzer cargo xml-rs 0.8.19 reader/parser/QualifiedNameTarget#ClosingTagNameTarget# => invoke_callback(self, t),
515
516 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::Characterrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#Character#(c) if is_whitespace_charrust-analyzer cargo xml-rs 0.8.19 common/is_whitespace_char().(c) => invoke_callback(self, t),
517
518 _ => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnexpectedQualifiedNamerust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnexpectedQualifiedName#(t))),
519 }
520 }
521
522 /// Dispatches tokens in order to process attribute value.
523 ///
524 /// # Parameters
525 /// * `t` --- next token;
526 /// * `on_value` --- a callback which is called when terminating quote is encountered.
527 fn read_attribute_valuerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]read_attribute_value().<F>(&mut self, t: Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#, on_value: F) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#>
528 where F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
529 match t {
530 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::Characterrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#Character#(c) if self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..quoterust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#quote..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() && is_whitespace_charrust-analyzer cargo xml-rs 0.8.19 common/is_whitespace_char().(c) => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, // skip leading whitespace
531
532 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::DoubleQuoterust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#DoubleQuote# | Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::SingleQuoterust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#SingleQuote# => match self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..quoterust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#quote. {
533 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { // Entered attribute value
534 self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..quoterust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#quote. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(QuoteTokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/QuoteToken#::from_tokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QuoteToken]from_token().(&t));
535 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
536 }
537 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(q) if q.as_tokenrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[QuoteToken]as_token().() rust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Token][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Token][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Token][`PartialEq<Self>`]eq().t => {
538 self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..quoterust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#quote. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
539 let value = self.take_bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]take_buf().();
540 on_value(self, value)
541 }
542 _ => {
543 if let Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::Characterrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#Character#(c) = t {
544 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.is_valid_xml_char_not_restrictedrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]is_valid_xml_char_not_restricted().(c) {
545 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::InvalidCharacterEntityrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#InvalidCharacterEntity#(c as u32)));
546 }
547 }
548 if self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().self.configrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#config..max_attribute_lengthrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#max_attribute_length. {
549 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::ExceededConfiguredLimitrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#ExceededConfiguredLimit#));
550 }
551 t.push_to_stringrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Token]push_to_string().(&mut self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf.);
552 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
553 }
554 },
555
556 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::ReferenceStartrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#ReferenceStart# if self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..quoterust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#quote..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() => {
557 self.state_after_referencerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#state_after_reference. = self.strust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#st.;
558 self.into_state_continuerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]into_state_continue().(Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::InsideReferencerust-analyzer cargo xml-rs 0.8.19 reader/parser/State#InsideReference#)
559 },
560
561 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::OpeningTagStartrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#OpeningTagStart# => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnexpectedOpeningTagrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnexpectedOpeningTag#)),
562
563 Tokenrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#::Characterrust-analyzer cargo xml-rs 0.8.19 reader/lexer/Token#Character#(c) if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.is_valid_xml_char_not_restrictedrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]is_valid_xml_char_not_restricted().(c) => {
564 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::InvalidCharacterEntityrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#InvalidCharacterEntity#(c as u32)))
565 },
566
567 // Every character except " and ' and < is okay
568 _ if self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..quoterust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#quote..is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().() => {
569 if self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().self.configrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#config..max_attribute_lengthrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#max_attribute_length. {
570 return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::ExceededConfiguredLimitrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#ExceededConfiguredLimit#));
571 }
572 t.push_to_stringrust-analyzer cargo xml-rs 0.8.19 reader/lexer/impl#[Token]push_to_string().(&mut self.bufrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#buf.);
573 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
574 }
575
576 _ => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnexpectedTokenrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnexpectedToken#(t))),
577 }
578 }
579
580 fn emit_start_elementrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]emit_start_element().(&mut self, emit_end_element: bool) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
581 let mut name = self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..take_element_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_element_name().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
582 let mut attributes = self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..take_attributesrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_attributes().().into_vecrust-analyzer cargo xml-rs 0.8.19 reader/indexset/impl#[AttributesSet]into_vec().();
583
584 // check whether the name prefix is bound and fix its namespace
585 match self.nstrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#nst..getrust-analyzer cargo xml-rs 0.8.19 namespace/impl#[NamespaceStack]get().(name.borrowrust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName]borrow().().prefix_reprrust-analyzer cargo xml-rs 0.8.19 name/impl#[`Name<'a>`]prefix_repr().()) {
586 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("") => name.namespacerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#namespace. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, // default namespace
587 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ns) => name.namespacerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#namespace. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ns.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
588 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnboundElementPrefixrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnboundElementPrefix#(name.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())))
589 }
590
591 // check and fix accumulated attributes prefixes
592 for attr in &mut attributes {
593 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ref pfx) = attr.namerust-analyzer cargo xml-rs 0.8.19 attribute/OwnedAttribute#name..prefixrust-analyzer cargo xml-rs 0.8.19 name/OwnedName#prefix. {
594 let new_ns = match self.nstrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#nst..getrust-analyzer cargo xml-rs 0.8.19 namespace/impl#[NamespaceStack]get().(pfx) {
595 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("") => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, // default namespace
596 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ns) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ns.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
597 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnboundAttributerust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnboundAttribute#(attr.namerust-analyzer cargo xml-rs 0.8.19 attribute/OwnedAttribute#name..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())))
598 };
599 attr.namerust-analyzer cargo xml-rs 0.8.19 attribute/OwnedAttribute#name..namespacerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#namespace. = new_ns;
600 }
601 }
602
603 if emit_end_element {
604 self.pop_namespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pop_namespace. = true;
605 self.next_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#next_event. = 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#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement# {
606 namerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement#name.: name.clonerust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName][Clone]clone().()
607 }));
608 } else {
609 self.estrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#est..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(name.clonerust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName][Clone]clone().());
610 }
611 let namespace = self.nstrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#nst..squashrust-analyzer cargo xml-rs 0.8.19 namespace/impl#[NamespaceStack]squash().();
612 self.into_state_emitrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]into_state_emit().(Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::OutsideTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#OutsideTag#, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement# {
613 namerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement#name.,
614 attributesrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement#attributes.,
615 namespacerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement#namespace.
616 }))
617 }
618
619 fn emit_end_elementrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]emit_end_element().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Resultrust-analyzer cargo xml-rs 0.8.19 reader/parser/Result#> {
620 let mut name = self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..take_element_namerust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[MarkupData]take_element_name().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
621
622 // check whether the name prefix is bound and fix its namespace
623 match self.nstrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#nst..getrust-analyzer cargo xml-rs 0.8.19 namespace/impl#[NamespaceStack]get().(name.borrowrust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName]borrow().().prefix_reprrust-analyzer cargo xml-rs 0.8.19 name/impl#[`Name<'a>`]prefix_repr().()) {
624 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("") => name.namespacerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#namespace. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, // default namespace
625 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ns) => name.namespacerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#namespace. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ns.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()),
626 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnboundElementPrefixrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnboundElementPrefix#(name.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())))
627 }
628
629 let op_name = self.estrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#est..poprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]pop().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
630
631 if name rust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName][`PartialEq<Self>`]eq().==rust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName][`PartialEq<Self>`]eq(). rust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName][`PartialEq<Self>`]eq().op_name {
632 self.pop_namespacerust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#pop_namespace. = true;
633 self.into_state_emitrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]into_state_emit().(Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#::OutsideTagrust-analyzer cargo xml-rs 0.8.19 reader/parser/State#OutsideTag#, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement# { namerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement#name. }))
634 } else {
635 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.errorrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]error().(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnexpectedClosingTagrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnexpectedClosingTag#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{name} != {op_name}").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())))
636 }
637 }
638
639 #[inline]
640 fn is_valid_xml_charrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]is_valid_xml_char().(&self, c: char) -> bool {
641 if Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(XmlVersionrust-analyzer cargo xml-rs 0.8.19 common/XmlVersion#::Version11rust-analyzer cargo xml-rs 0.8.19 common/XmlVersion#Version11#) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..versionrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#version. {
642 is_xml11_charrust-analyzer cargo xml-rs 0.8.19 common/is_xml11_char().(c)
643 } else {
644 is_xml10_charrust-analyzer cargo xml-rs 0.8.19 common/is_xml10_char().(c)
645 }
646 }
647
648 #[inline]
649 fn is_valid_xml_char_not_restrictedrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]is_valid_xml_char_not_restricted().(&self, c: char) -> bool {
650 if Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(XmlVersionrust-analyzer cargo xml-rs 0.8.19 common/XmlVersion#::Version11rust-analyzer cargo xml-rs 0.8.19 common/XmlVersion#Version11#) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][`PartialEq<Self>`]eq().self.datarust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#data..versionrust-analyzer cargo xml-rs 0.8.19 reader/parser/MarkupData#version. {
651 is_xml11_char_not_restrictedrust-analyzer cargo xml-rs 0.8.19 common/is_xml11_char_not_restricted().(c)
652 } else {
653 is_xml10_charrust-analyzer cargo xml-rs 0.8.19 common/is_xml10_char().(c)
654 }
655 }
656 }
657
658 #[cfg(test)]
659 mod testsrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/ {
660 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::BufReaderrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/buffered/bufreader/BufReader#;
661 use craterust-analyzer cargo xml-rs 0.8.19 crate/::attributerust-analyzer cargo xml-rs 0.8.19 attribute/::OwnedAttributerust-analyzer cargo xml-rs 0.8.19 attribute/OwnedAttribute#;
662 use craterust-analyzer cargo xml-rs 0.8.19 crate/::commonrust-analyzer cargo xml-rs 0.8.19 common/::TextPositionrust-analyzer cargo xml-rs 0.8.19 common/TextPosition#;
663 use craterust-analyzer cargo xml-rs 0.8.19 crate/::namerust-analyzer cargo xml-rs 0.8.19 name/::OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#;
664 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::eventsrust-analyzer cargo xml-rs 0.8.19 reader/events/::XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#;
665 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::parserrust-analyzer cargo xml-rs 0.8.19 reader/parser/::PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#;
666 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::ParserConfigrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig#;
667
668 fn new_parserrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/new_parser().() -> PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser# {
669 PullParserrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#::newrust-analyzer cargo xml-rs 0.8.19 reader/parser/impl#[PullParser]new().(ParserConfigrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig#::newrust-analyzer cargo xml-rs 0.8.19 reader/config/impl#[ParserConfig]new().())
670 }
671
672 macro_rules! expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!(
673 ($r:expr, $p:expr, $t:pat) => (
674 match $p.next(&mut $r) {
675 $t => {}
676 e => panic!("Unexpected event: {e:?}\nExpected: {}", stringify!($t))
677 }
678 );
679 ($r:expr, $p:expr, $t:pat => $c:expr ) => (
680 match $p.next(&mut $r) {
681 $t if $c => {}
682 e => panic!("Unexpected event: {e:?}\nExpected: {} if {}", stringify!($t), stringify!($c))
683 }
684 )
685 );
686
687 macro_rules! test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!(
688 ($d:expr) => ({
689 static DATA: &'static str = $d;
690 let r = BufReader::new(DATA.as_bytes());
691 let p = new_parser();
692 (r, p)
693 })
694 );
695
696 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
697 fn issue_3_semicolon_in_attribute_valuerust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/issue_3_semicolon_in_attribute_value().() {
698 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"
699 <a attr="zzz;zzz" />
700 "#);
701
702 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument# { .. }));
703 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement# { ref namerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement#name., ref attributesrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement#attributes., ref namespacerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement#namespace. }) =>
704 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().name == OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#::localrust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName]local().("a") &&
705 attributes.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() == 1 &&
706 attributes[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == OwnedAttributerust-analyzer cargo xml-rs 0.8.19 attribute/OwnedAttribute#::newrust-analyzer cargo xml-rs 0.8.19 attribute/impl#[OwnedAttribute]new().(OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#::localrust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName]local().("attr"), "zzz;zzz") &&
707 namespace.is_essentially_emptyrust-analyzer cargo xml-rs 0.8.19 namespace/impl#[Namespace]is_essentially_empty().()
708 );
709 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement# { ref namerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement#name. }) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().name == OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#::localrust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName]local().("a"));
710 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndDocument#));
711 }
712
713 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
714 fn issue_140_entity_reference_inside_tagrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/issue_140_entity_reference_inside_tag().() {
715 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"
716 <bla>&#9835;</bla>
717 "#);
718
719 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument# { .. }));
720 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement# { ref namerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement#name., .. }) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().name == OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#::localrust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName]local().("bla"));
721 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::Charactersrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#Characters#(ref s)) => s == "\u{266b}");
722 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement# { ref namerust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement#name., .. }) => *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().name == OwnedNamerust-analyzer cargo xml-rs 0.8.19 name/OwnedName#::localrust-analyzer cargo xml-rs 0.8.19 name/impl#[OwnedName]local().("bla"));
723 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndDocument#));
724 }
725
726 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
727 fn issue_220_commentrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/issue_220_comment().() {
728 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"<x><!-- <!--></x>"#);
729 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument# { .. }));
730 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement# { .. }));
731 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement# { .. }));
732 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndDocument#));
733
734 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"<x><!-- <!---></x>"#);
735 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument# { .. }));
736 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement# { .. }));
737 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_)); // ---> is forbidden in comments
738
739 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"<x><!--<text&x;> <!--></x>"#);
740 p.configrust-analyzer cargo xml-rs 0.8.19 reader/parser/PullParser#config..crust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig2#c..ignore_commentsrust-analyzer cargo xml-rs 0.8.19 reader/config/ParserConfig#ignore_comments. = false;
741 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument# { .. }));
742 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement# { .. }));
743 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::Commentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#Comment#(s)) => s == "<text&x;> <!");
744 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndElement# { .. }));
745 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::EndDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#EndDocument#));
746 }
747
748 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
749 fn malformed_declaration_attrsrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/malformed_declaration_attrs().() {
750 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"<?xml version x="1.0"?>"#);
751 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_));
752
753 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"<?xml version="1.0" version="1.0"?>"#);
754 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_));
755
756 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"<?xml version="1.0"encoding="utf-8"?>"#);
757 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_));
758
759 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"<?xml version="1.0"standalone="yes"?>"#);
760 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_));
761
762 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"<?xml version="1.0" encoding="utf-8"standalone="yes"?>"#);
763 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_));
764 }
765
766 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
767 fn opening_tag_in_attribute_valuerust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/opening_tag_in_attribute_value().() {
768 use craterust-analyzer cargo xml-rs 0.8.19 crate/::readerrust-analyzer cargo xml-rs 0.8.19 reader/::errorrust-analyzer cargo xml-rs 0.8.19 reader/error/::{SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#, Errorrust-analyzer cargo xml-rs 0.8.19 reader/error/Error#, ErrorKindrust-analyzer cargo xml-rs 0.8.19 reader/error/ErrorKind#};
769
770 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"
771 <a attr="zzz<zzz" />
772 "#);
773
774 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument# { .. }));
775 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ref e) =>
776 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().e == Errorrust-analyzer cargo xml-rs 0.8.19 reader/error/Error# {
777 kindrust-analyzer cargo xml-rs 0.8.19 reader/error/Error#kind.: ErrorKindrust-analyzer cargo xml-rs 0.8.19 reader/error/ErrorKind#::Syntaxrust-analyzer cargo xml-rs 0.8.19 reader/error/ErrorKind#Syntax#(SyntaxErrorrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#::UnexpectedOpeningTagrust-analyzer cargo xml-rs 0.8.19 reader/error/SyntaxError#UnexpectedOpeningTag#.to_cowrust-analyzer cargo xml-rs 0.8.19 reader/error/impl#[SyntaxError]to_cow().()),
778 posrust-analyzer cargo xml-rs 0.8.19 reader/error/Error#pos.: TextPositionrust-analyzer cargo xml-rs 0.8.19 common/TextPosition# { rowrust-analyzer cargo xml-rs 0.8.19 common/TextPosition#row.: 1, columnrust-analyzer cargo xml-rs 0.8.19 common/TextPosition#column.: 24 }
779 }
780 );
781 }
782
783 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
784 fn reference_errrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/reference_err().() {
785 let (mut r, mut p) = test_datarust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/test_data!!(r#"
786 <a>&&amp;</a>
787 "#);
788
789 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartDocumentrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartDocument# { .. }));
790 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(XmlEventrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#::StartElementrust-analyzer cargo xml-rs 0.8.19 reader/events/XmlEvent#StartElement# { .. }));
791 expect_eventrust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/expect_event!!(r, p, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_));
792 }
793
794 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
795 fn state_sizerust-analyzer cargo xml-rs 0.8.19 reader/parser/tests/state_size().() {
796 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(2, stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<superrust-analyzer cargo xml-rs 0.8.19 reader/parser/::Staterust-analyzer cargo xml-rs 0.8.19 reader/parser/State#>());
797 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(1, stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<superrust-analyzer cargo xml-rs 0.8.19 reader/parser/::DoctypeSubstaterust-analyzer cargo xml-rs 0.8.19 reader/parser/DoctypeSubstate#>());
798 }
799 }