From 24caa20aad9c1ae9f881d468e9dba0143f2effd7 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 4 Apr 2020 14:05:26 -0400 Subject: [PATCH] implement Debug for SassFunction --- src/value/function.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/value/function.rs b/src/value/function.rs index d091f70..522f5de 100644 --- a/src/value/function.rs +++ b/src/value/function.rs @@ -22,6 +22,13 @@ impl SassFunction { } } + fn kind(&self) -> &'static str { + match &self { + Self::Builtin(..) => "Builtin", + Self::UserDefined(..) => "UserDefined", + } + } + pub fn call(self, args: CallArgs, scope: &Scope) -> SassResult { match self { Self::Builtin(f, ..) => f.0(args, scope), @@ -33,7 +40,11 @@ impl SassFunction { impl fmt::Debug for SassFunction { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - todo!() + f.debug_struct("SassFunction") + .field("name", &self.name()) + .field("kind", &self.kind()) + .finish() + } }