regulus 0.0.14

A simple, interpreted language with very simple syntax and zero dependencies
Documentation
use crate::atom::Atom;
use std::ops::Deref;
use std::rc::Rc;

#[derive(Debug, Clone, PartialEq)]
pub struct List(pub Rc<Vec<Atom>>);

impl List {
    pub fn new(v: Vec<Atom>) -> Self {
        Self(Rc::new(v))
    }

    pub fn make_mut(&mut self) -> &mut Vec<Atom> {
        Rc::make_mut(&mut self.0)
    }

    pub fn into_inner(self) -> Vec<Atom> {
        Rc::unwrap_or_clone(self.0)
    }
}

impl Deref for List {
    type Target = Vec<Atom>;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}