55use std:: borrow:: Cow ;
66
77#[ cfg( feature = "encoding" ) ]
8- use crate :: reader:: EncodingRef ;
9- #[ cfg( feature = "encoding" ) ]
10- use encoding_rs:: { Encoding , UTF_8 } ;
8+ use encoding_rs:: Encoding ;
119
1210use crate :: errors:: { Error , Result } ;
1311use crate :: events:: Event ;
@@ -16,35 +14,10 @@ use crate::reader::{is_whitespace, BangType, ReadElementState, Reader, Span, Xml
1614
1715use memchr;
1816
19- use super :: parser:: Parser ;
20-
2117/// This is an implementation of [`Reader`] for reading from a `&[u8]` as
2218/// underlying byte stream. This implementation supports not using an
2319/// intermediate buffer as the byte slice itself can be used to borrow from.
2420impl < ' a > Reader < & ' a [ u8 ] > {
25- /// Creates an XML reader from a string slice.
26- #[ allow( clippy:: should_implement_trait) ]
27- pub fn from_str ( s : & ' a str ) -> Self {
28- // Rust strings are guaranteed to be UTF-8, so lock the encoding
29- #[ cfg( feature = "encoding" ) ]
30- {
31- let mut parser = Parser :: default ( ) ;
32- parser. encoding = EncodingRef :: Explicit ( UTF_8 ) ;
33- Self {
34- reader : s. as_bytes ( ) ,
35- parser : parser,
36- }
37- }
38-
39- #[ cfg( not( feature = "encoding" ) ) ]
40- {
41- Self {
42- reader : s. as_bytes ( ) ,
43- parser : Parser :: default ( ) ,
44- }
45- }
46- }
47-
4821 /// Read an event that borrows from the input rather than a buffer.
4922 ///
5023 /// There is no asynchronous `read_event_async()` version of this function,
0 commit comments