diff --git a/maraiah/shp.rs b/maraiah/shp.rs index 4e72f7a..13e2fb5 100644 --- a/maraiah/shp.rs +++ b/maraiah/shp.rs @@ -29,8 +29,7 @@ pub fn read(fp: &mut impl Read) -> ResultS let mut b = Vec::new(); fp.read_to_end(&mut b)?; - // hush little rustc, don't say a word... - let mut collections: Collections = unsafe {std::mem::uninitialized()}; + let mut collections = vec![(None, None); 32]; for (i, co) in collections.iter_mut().enumerate() { read_data! { @@ -55,6 +54,6 @@ pub fn read(fp: &mut impl Read) -> ResultS pub type CollectionDef = (Option, Option); /// The set of all collections in a Shapes file. -pub type Collections = [CollectionDef; 32]; +pub type Collections = Vec; // EOF diff --git a/maraiah/shp/bmap.rs b/maraiah/shp/bmap.rs index 9223358..1a64ae4 100644 --- a/maraiah/shp/bmap.rs +++ b/maraiah/shp/bmap.rs @@ -112,7 +112,7 @@ impl Image for ImageShp<'_, '_> } /// An unpacked Shape bitmap. -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Bitmap { w: usize, h: usize, diff --git a/maraiah/shp/coll.rs b/maraiah/shp/coll.rs index fd2c5c6..0883d33 100644 --- a/maraiah/shp/coll.rs +++ b/maraiah/shp/coll.rs @@ -35,7 +35,7 @@ pub fn read(b: &[u8]) -> ResultS } /// A collection of color tables, bitmaps, frames and sequences. -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Collection { /// The type of collection this is. pub ctyp: CollectionType, diff --git a/maraiah/shp/fram.rs b/maraiah/shp/fram.rs index b3ab059..7ef336d 100644 --- a/maraiah/shp/fram.rs +++ b/maraiah/shp/fram.rs @@ -24,7 +24,7 @@ pub fn read(b: &[u8]) -> ResultS /// A frame, also known as a low level shape. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Frame { /// The flags for this frame. pub flags: FrameFlags, diff --git a/maraiah/shp/sequ.rs b/maraiah/shp/sequ.rs index c3c1b3c..32e7fbb 100644 --- a/maraiah/shp/sequ.rs +++ b/maraiah/shp/sequ.rs @@ -31,7 +31,7 @@ pub fn read(b: &[u8]) -> ResultS /// A sequence, also known as a high level shape. #[cfg_attr(feature = "serde_obj", derive(serde::Serialize))] -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Sequence { /// The display name for this sequence. pub name: String,