Skip to content

Commit

Permalink
Group impls with their types
Browse files Browse the repository at this point in the history
Some ickiness left over from #99
  • Loading branch information
brendanzab committed Aug 13, 2018
1 parent 0b9ae63 commit 43f9cf4
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions src/syntax/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,34 +83,6 @@ pub enum Term {
Array(ByteSpan, Vec<RcTerm>),
}

/// Reference counted terms
#[derive(Debug, Clone, PartialEq, BoundTerm)]
pub struct RcTerm {
pub inner: Rc<Term>,
}

impl From<Term> for RcTerm {
fn from(src: Term) -> RcTerm {
RcTerm {
inner: Rc::new(src),
}
}
}

impl ops::Deref for RcTerm {
type Target = Term;

fn deref(&self) -> &Term {
&self.inner
}
}

impl fmt::Display for RcTerm {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(&self.inner, f)
}
}

impl Term {
pub fn span(&self) -> ByteSpan {
match *self {
Expand Down Expand Up @@ -139,3 +111,31 @@ impl fmt::Display for Term {
self.to_doc().group().render_fmt(pretty::FALLBACK_WIDTH, f)
}
}

/// Reference counted terms
#[derive(Debug, Clone, PartialEq, BoundTerm)]
pub struct RcTerm {
pub inner: Rc<Term>,
}

impl From<Term> for RcTerm {
fn from(src: Term) -> RcTerm {
RcTerm {
inner: Rc::new(src),
}
}
}

impl ops::Deref for RcTerm {
type Target = Term;

fn deref(&self) -> &Term {
&self.inner
}
}

impl fmt::Display for RcTerm {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(&self.inner, f)
}
}

0 comments on commit 43f9cf4

Please sign in to comment.