Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbabcock committed Dec 19, 2023
1 parent dd733ee commit a74f6a1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/text/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
T: DeserializeOwned,
R: Read,
{
TextDeserializer::from_windows1252_reader(reader).deserialize()
TextDeserializer::from_windows1252_reader(TokenReader::new(reader)).deserialize()
}

/// Convenience method for deserializing streaming utf8 data into a Rust value
Expand All @@ -141,7 +141,7 @@ where
T: DeserializeOwned,
R: Read,
{
TextDeserializer::from_utf8_reader(reader).deserialize()
TextDeserializer::from_utf8_reader(TokenReader::new(reader)).deserialize()
}

/// Convenience method for parsing the given text data and deserializing as utf8 encoded.
Expand Down Expand Up @@ -786,25 +786,27 @@ impl TextDeserializer<'_, '_, Windows1252Encoding> {
///
/// Considered experimental as it uses a [TokenReader] under the hood, which
/// uses a different parsing routine geared toward save files.
pub fn from_windows1252_reader<R>(reader: R) -> TextReaderDeserializer<R, Windows1252Encoding>
pub fn from_windows1252_reader<R>(
reader: TokenReader<R>,
) -> TextReaderDeserializer<R, Windows1252Encoding>
where
R: Read,
{
TextReaderDeserializer {
reader: TokenReader::new(reader),
reader,
encoding: Windows1252Encoding,
}
}
}

impl TextDeserializer<'_, '_, Utf8Encoding> {
/// Create a UTF8 text deserializer over a reader
pub fn from_utf8_reader<R>(reader: R) -> TextReaderDeserializer<R, Utf8Encoding>
pub fn from_utf8_reader<R>(reader: TokenReader<R>) -> TextReaderDeserializer<R, Utf8Encoding>
where
R: Read,
{
TextReaderDeserializer {
reader: TokenReader::new(reader),
reader,
encoding: Utf8Encoding,
}
}
Expand Down

0 comments on commit a74f6a1

Please sign in to comment.