use crate::{Mode, Node, NodeID, Type};
use leo_span::Span;
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Output {
pub mode: Mode,
pub type_: Type,
pub span: Span,
pub id: NodeID,
}
impl Output {
pub fn type_(&self) -> &Type {
&self.type_
}
pub fn mode(&self) -> Mode {
self.mode
}
}
impl fmt::Display for Output {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.mode == Mode::None { write!(f, "{}", self.type_) } else { write!(f, "{} {}", self.mode, self.type_) }
}
}
crate::simple_node_impl!(Output);