Skip to content

open_stream as mut and read_stream as non-mut #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,15 @@ impl<F: Seek> CompoundFile<F> {
self.open_stream_with_path(path.as_ref())
}

fn open_stream_with_path(&mut self, path: &Path) -> io::Result<Stream<F>> {
/// Reads an existing stream in the compound file for reading
pub fn read_stream<P: AsRef<Path>>(
&self,
path: P,
) -> io::Result<Stream<F>> {
self.open_stream_with_path(path.as_ref())
}

fn open_stream_with_path(&self, path: &Path) -> io::Result<Stream<F>> {
let names = internal::path::name_chain_from_path(path)?;
let path = internal::path::path_from_name_chain(&names);
let stream_id = match self.stream_id_for_name_chain(&names) {
Expand Down