Skip to content

Commit

Permalink
add set_encoding function
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Sep 6, 2022
1 parent a6c2d48 commit 916d882
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/reading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,14 @@ impl<T: Read + Seek> Reader<T> {
/// See [`Self::new`] for more information.
pub fn new_with_encoding<E: Encoding + 'static>(source: T, encoding: E) -> Result<Self, Error> {
let mut reader = Self::new(source)?;
reader.encoding = DynEncoding::new(encoding);
reader.set_encoding(encoding);
Ok(reader)
}

pub fn set_encoding<E: Encoding + 'static>(&mut self, encoding: E) {
self.encoding = DynEncoding::new(encoding);
}

/// Returns the header of the file
pub fn header(&self) -> &Header {
&self.header
Expand Down

0 comments on commit 916d882

Please sign in to comment.