fix: derive default instead

main
Anna Clemens 2 months ago
parent ea1bb1b751
commit 7ff032af63
Signed by: ascclemens
GPG Key ID: 0B391D8F06FCD9E0

@ -76,11 +76,11 @@ pub struct ReferenceBlockRange {
pub end: u32,
}
#[derive(Debug)]
#[derive(Debug, Default)]
#[cfg(all(feature = "read", feature = "write"))]
#[derive(binrw::BinRead, binrw::BinWrite)]
pub struct ModelSectionInfo<T>
where T: binrw::BinRead + binrw::BinWrite<Args=()>,
where T: Default + binrw::BinRead + binrw::BinWrite<Args=()>,
<T as binrw::BinRead>::Args: Default,
{
pub stack: T,
@ -90,11 +90,11 @@ pub struct ModelSectionInfo<T>
pub index_buffer: [T; 3],
}
#[derive(Debug)]
#[derive(Debug, Default)]
#[cfg(all(feature = "write", not(feature = "read")))]
#[derive(binrw::BinWrite)]
pub struct ModelSectionInfo<T>
where T: binrw::BinWrite<Args=()>,
where T: Default + binrw::BinWrite<Args=()>,
{
pub stack: T,
pub runtime: T,
@ -103,11 +103,11 @@ pub struct ModelSectionInfo<T>
pub index_buffer: [T; 3],
}
#[derive(Debug)]
#[derive(Debug, Default)]
#[cfg(all(feature = "read", not(feature = "write")))]
#[derive(binrw::BinRead)]
pub struct ModelSectionInfo<T>
where T: binrw::BinRead,
where T: Default + binrw::BinRead,
<T as binrw::BinRead>::Args: Default,
{
pub stack: T,
@ -117,9 +117,9 @@ pub struct ModelSectionInfo<T>
pub index_buffer: [T; 3],
}
#[derive(Debug)]
#[derive(Debug, Default)]
#[cfg(not(any(feature = "read", feature = "write")))]
pub struct ModelSectionInfo<T> {
pub struct ModelSectionInfo<T: Default> {
pub stack: T,
pub runtime: T,
pub vertex_buffer: [T; 3],
@ -127,18 +127,6 @@ pub struct ModelSectionInfo<T> {
pub index_buffer: [T; 3],
}
impl<T: Default> Default for ModelSectionInfo<T> {
fn default() -> Self {
Self {
stack: T::default(),
runtime: T::default(),
vertex_buffer: [T::default(), T::default(), T::default()],
edge_geometry_vertex_buffer: [T::default(), T::default(), T::default()],
index_buffer: [T::default(), T::default(), T::default()],
}
}
}
#[derive(Debug, Default)]
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]

Loading…
Cancel
Save