From 916d882b72921a5738461926eeaf106602c02799 Mon Sep 17 00:00:00 2001 From: tmontaigu Date: Tue, 6 Sep 2022 19:09:48 +0200 Subject: [PATCH] add set_encoding function --- src/reading.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/reading.rs b/src/reading.rs index e190738..fbf841c 100644 --- a/src/reading.rs +++ b/src/reading.rs @@ -226,10 +226,14 @@ impl Reader { /// See [`Self::new`] for more information. pub fn new_with_encoding(source: T, encoding: E) -> Result { let mut reader = Self::new(source)?; - reader.encoding = DynEncoding::new(encoding); + reader.set_encoding(encoding); Ok(reader) } + pub fn set_encoding(&mut self, encoding: E) { + self.encoding = DynEncoding::new(encoding); + } + /// Returns the header of the file pub fn header(&self) -> &Header { &self.header