mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 18:54:05 +02:00
generic params are allowed to have real names
This commit is contained in:
parent
5912584a74
commit
9c85ff5885
1 changed files with 12 additions and 12 deletions
|
|
@ -473,23 +473,23 @@ impl Packfile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_read_enum<T, R, E, F>(
|
fn try_read_enum<Enum, Reader, Error, ErrorFn>(
|
||||||
reader: &mut R,
|
reader: &mut Reader,
|
||||||
options: &ReadOptions,
|
options: &ReadOptions,
|
||||||
args: <<T as TryFromPrimitive>::Primitive as BinRead>::Args,
|
args: <<Enum as TryFromPrimitive>::Primitive as BinRead>::Args,
|
||||||
err_map: F,
|
err_map: ErrorFn,
|
||||||
) -> BinResult<T>
|
) -> BinResult<Enum>
|
||||||
where
|
where
|
||||||
R: Read + Seek,
|
Reader: Read + Seek,
|
||||||
T: TryFromPrimitive,
|
Enum: TryFromPrimitive,
|
||||||
T::Primitive: BinRead,
|
Enum::Primitive: BinRead,
|
||||||
F: FnOnce(T::Primitive) -> E,
|
ErrorFn: FnOnce(Enum::Primitive) -> Error,
|
||||||
E: CustomError + 'static,
|
Error: CustomError + 'static,
|
||||||
{
|
{
|
||||||
let start = reader.stream_position().unwrap();
|
let start = reader.stream_position().unwrap();
|
||||||
let raw = <T::Primitive>::read_options(reader, options, args)?;
|
let raw = <Enum::Primitive>::read_options(reader, options, args)?;
|
||||||
|
|
||||||
T::try_from_primitive(raw)
|
Enum::try_from_primitive(raw)
|
||||||
.map_err(|e| err_map(e.number))
|
.map_err(|e| err_map(e.number))
|
||||||
.map_err(|e| binrw::Error::Custom {
|
.map_err(|e| binrw::Error::Custom {
|
||||||
pos: start,
|
pos: start,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue