caco 0.5.33

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

/// A classic Doom lump, a single named component within a classic Doom [wad](crate::wad::Wad).
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct DoomLump {
    /// Name of the lump. Will be truncated to 8 characters.
    pub name: String,

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

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

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

impl ClumpMut for DoomLump {
    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();
    }
}