fix: derive default instead
This commit is contained in:
parent
ea1bb1b751
commit
7ff032af63
|
@ -76,11 +76,11 @@ pub struct ReferenceBlockRange {
|
||||||
pub end: u32,
|
pub end: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
#[cfg(all(feature = "read", feature = "write"))]
|
#[cfg(all(feature = "read", feature = "write"))]
|
||||||
#[derive(binrw::BinRead, binrw::BinWrite)]
|
#[derive(binrw::BinRead, binrw::BinWrite)]
|
||||||
pub struct ModelSectionInfo<T>
|
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,
|
<T as binrw::BinRead>::Args: Default,
|
||||||
{
|
{
|
||||||
pub stack: T,
|
pub stack: T,
|
||||||
|
@ -90,11 +90,11 @@ pub struct ModelSectionInfo<T>
|
||||||
pub index_buffer: [T; 3],
|
pub index_buffer: [T; 3],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
#[cfg(all(feature = "write", not(feature = "read")))]
|
#[cfg(all(feature = "write", not(feature = "read")))]
|
||||||
#[derive(binrw::BinWrite)]
|
#[derive(binrw::BinWrite)]
|
||||||
pub struct ModelSectionInfo<T>
|
pub struct ModelSectionInfo<T>
|
||||||
where T: binrw::BinWrite<Args=()>,
|
where T: Default + binrw::BinWrite<Args=()>,
|
||||||
{
|
{
|
||||||
pub stack: T,
|
pub stack: T,
|
||||||
pub runtime: T,
|
pub runtime: T,
|
||||||
|
@ -103,11 +103,11 @@ pub struct ModelSectionInfo<T>
|
||||||
pub index_buffer: [T; 3],
|
pub index_buffer: [T; 3],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
#[cfg(all(feature = "read", not(feature = "write")))]
|
#[cfg(all(feature = "read", not(feature = "write")))]
|
||||||
#[derive(binrw::BinRead)]
|
#[derive(binrw::BinRead)]
|
||||||
pub struct ModelSectionInfo<T>
|
pub struct ModelSectionInfo<T>
|
||||||
where T: binrw::BinRead,
|
where T: Default + binrw::BinRead,
|
||||||
<T as binrw::BinRead>::Args: Default,
|
<T as binrw::BinRead>::Args: Default,
|
||||||
{
|
{
|
||||||
pub stack: T,
|
pub stack: T,
|
||||||
|
@ -117,9 +117,9 @@ pub struct ModelSectionInfo<T>
|
||||||
pub index_buffer: [T; 3],
|
pub index_buffer: [T; 3],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
#[cfg(not(any(feature = "read", feature = "write")))]
|
#[cfg(not(any(feature = "read", feature = "write")))]
|
||||||
pub struct ModelSectionInfo<T> {
|
pub struct ModelSectionInfo<T: Default> {
|
||||||
pub stack: T,
|
pub stack: T,
|
||||||
pub runtime: T,
|
pub runtime: T,
|
||||||
pub vertex_buffer: [T; 3],
|
pub vertex_buffer: [T; 3],
|
||||||
|
@ -127,18 +127,6 @@ pub struct ModelSectionInfo<T> {
|
||||||
pub index_buffer: [T; 3],
|
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)]
|
#[derive(Debug, Default)]
|
||||||
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
#[cfg_attr(feature = "read", derive(binrw::BinRead), br(little))]
|
||||||
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
#[cfg_attr(feature = "write", derive(binrw::BinWrite), bw(little))]
|
||||||
|
|
Loading…
Reference in New Issue