Interpreter - Basic, mostly empty class data structure
This commit is contained in:
parent
afb465d6df
commit
6fa335b2f6
1 changed files with 18 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
/// A Lox class.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Class {
|
||||
name: String,
|
||||
}
|
||||
|
||||
impl Class {
|
||||
/// Create a new class, specifying its name.
|
||||
pub fn new(name: String) -> Self {
|
||||
Self { name }
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for Class {
|
||||
fn to_string(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue