Skip to content
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

Byteview #15

Merged
merged 24 commits into from
Feb 4, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use ByteView::from_reader
marvin-j97 committed Jan 12, 2025
commit ab7c10b761c003758deb326e92cd15c5a399b11b
12 changes: 2 additions & 10 deletions src/slice/slice_arc.rs
Original file line number Diff line number Diff line change
@@ -24,16 +24,8 @@ impl Slice {

#[doc(hidden)]
pub fn from_reader<R: std::io::Read>(reader: &mut R, len: usize) -> std::io::Result<Self> {
use std::ops::DerefMut;

// TODO: impl from_reader in Byteview, can skip get_mut in "constructor"
let mut view = Self::with_size(len);
{
let mut builder = view.0.get_mut().expect("we are the owner");
reader.read_exact(builder.deref_mut())?;
}

Ok(view)
let view = ByteView::from_reader(reader, len)?;
Ok(Self(view))
}
}