mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 04:12:42 +00:00
19 lines
369 B
Rust
19 lines
369 B
Rust
|
|
use std::fmt::Display;
|
||
|
|
|
||
|
|
#[derive(Debug)]
|
||
|
|
pub struct LoxClass {
|
||
|
|
name: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl LoxClass {
|
||
|
|
pub fn new(name: impl Into<String>) -> Self {
|
||
|
|
let name = name.into();
|
||
|
|
LoxClass { name }
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Display for LoxClass {
|
||
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||
|
|
write!(f, "<class {}>", self.name)
|
||
|
|
}
|
||
|
|
}
|