Skip to content

Commit

Permalink
WIP: Make Vec use count instead of count_with.
Browse files Browse the repository at this point in the history
I'm not sure of the semver considerations of changing the signature
of count like this is. Does this accept strictly more code, or is
there code that previously would have been accepted that is no
longer accepted?
  • Loading branch information
kitlith committed Feb 22, 2025
1 parent cc2caac commit c313164
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion binrw/src/binread/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ where
endian: Endian,
args: Self::Args<'_>,
) -> BinResult<Self> {
crate::helpers::count_with(args.count, B::read_options)(reader, endian, args.inner)
crate::helpers::count(args.count)(reader, endian, args.inner)
}
}

Expand Down
4 changes: 2 additions & 2 deletions binrw/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,9 @@ where
/// # let x: CountBytes = x.read_be().unwrap();
/// # assert_eq!(x.data, &[1, 2, 3]);
/// ```
pub fn count<R, T, Arg, Ret>(n: usize) -> impl Fn(&mut R, Endian, Arg) -> BinResult<Ret>
pub fn count<'a, R, T, Arg, Ret>(n: usize) -> impl Fn(&mut R, Endian, Arg) -> BinResult<Ret>
where
T: for<'a> BinRead<Args<'a> = Arg>,
T: BinRead<Args<'a> = Arg>,
R: Read + Seek,
Arg: Clone,
Ret: FromIterator<T> + 'static,
Expand Down

0 comments on commit c313164

Please sign in to comment.