caco 0.5.33

library for dealing with doom [et al] wad files
Documentation
use crate::agnostic::{Clump, ClumpMut};

/// A lump (named data entry) from a Quake PACK format file.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct QuakePackLump {
    /// Name of the lump. Will be truncated to 50 characters.
    /// This should contain a file extension (todo can someone verify this?)
    pub name: String,

    /// Raw data contained in the lump.
    pub data: Box<[u8]>,
}

impl Clump for QuakePackLump {
    fn name(&self) -> &String {
        &self.name
    }

    fn bytestuff(&self) -> &Box<[u8]> {
        &self.data
    }
}

impl ClumpMut for QuakePackLump {
    fn rename(&mut self, s: impl AsRef<str>) {
        self.name = s.as_ref().to_string();
    }

    fn replace(&mut self, b: &[u8]) {
        self.data = b.into();
    }
}