From 6fa335b2f607b3d627887e070929c671bfc9c2e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 7 Jan 2023 14:14:45 +0100 Subject: [PATCH] Interpreter - Basic, mostly empty class data structure --- src/interpreter/class.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/interpreter/class.rs b/src/interpreter/class.rs index e69de29..d83b7e1 100644 --- a/src/interpreter/class.rs +++ b/src/interpreter/class.rs @@ -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() + } +}