use std::fmt::Result; use swc_common::Spanned; /// /// # Type parameters /// /// ## `T` /// /// The type of the ast node. pub trait Emit where T: Spanned, { fn emit(&mut self, node: &T) -> Result; } impl Emit<&'_ T> for E where E: Emit, T: Spanned, { #[allow(clippy::only_used_in_recursion)] #[inline] fn emit(&mut self, node: &&'_ T) -> Result { self.emit(&**node) } } impl Emit> for E where E: Emit, T: Spanned, { #[inline] fn emit(&mut self, node: &Box) -> Result { self.emit(&**node) } } impl Emit> for E where E: Emit, T: Spanned, { #[inline] fn emit(&mut self, node: &Option) -> Result { match node { Some(node) => self.emit(node), None => Ok(()), } } }