πŸ¦€ RUST PATTERN DIFFICULTY: Adept Creational

Prototype of the Clone Vats

Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Biomancy // Cloning
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// RUST IDIOMATIC PATTERN //
#[derive(Clone, Debug)]
pub struct Replicant {
    pub designation: String,
    pub bio_signature: Vec<u8>,
    pub memories: Vec<String>,
}

impl Replicant {
    pub fn new(designation: &str) -> Self {
        Self {
            designation: designation.to_string(),
            bio_signature: vec![0xDE, 0xAD, 0xBE, 0xEF],
            memories: vec!["I've seen things you people wouldn't believe...".to_string()],
        }
    }
}

// Cloning usage
// let alpha = Replicant::new("Nexus-Alpha");
// let mut beta = alpha.clone();
// beta.designation = "Nexus-Beta".to_string();

In the sterile hum of the corp-cloning vats, birthing a new entity from scratch is a costly expenditure of biomatter and compute. The Prototype pattern is the dark art of the clone-weavers.

By implementing Clone, a cyber-mage can instantiate an archetypal replicant and duplicate its exact memory engrams and bio-signatures almost instantaneously. Modification of the clone’s identity takes fractions of a cycle, avoiding the heavy toll of pure conjuration.

Runic Tags: #creational #prototype #biomancy #cloning