21 lines
552 B
Rust
21 lines
552 B
Rust
use std::fmt;
|
|
use absy::Variable;
|
|
|
|
#[derive(Clone, PartialEq, Serialize, Deserialize)]
|
|
pub struct Parameter {
|
|
pub id: Variable,
|
|
pub private: bool,
|
|
}
|
|
|
|
impl fmt::Display for Parameter {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
let visibility = if self.private { "private " } else { "" };
|
|
write!(f, "{}{} {}", visibility, self.id._type, self.id.id)
|
|
}
|
|
}
|
|
|
|
impl fmt::Debug for Parameter {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
write!(f, "Parameter(variable: {:?})", self.id)
|
|
}
|
|
}
|