From 41ef953114c06ec2e0bfb06959497a6642d8f91c Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 8 Nov 2022 12:55:32 -0800 Subject: [PATCH] Implement 'Object' for 'Arc' (#139) --- minijinja/src/value/object.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/minijinja/src/value/object.rs b/minijinja/src/value/object.rs index 92364fa3..abd84628 100644 --- a/minijinja/src/value/object.rs +++ b/minijinja/src/value/object.rs @@ -76,3 +76,21 @@ pub trait Object: fmt::Display + fmt::Debug + Any + Sync + Send { )) } } + +impl Object for std::sync::Arc { + fn get_attr(&self, name: &str) -> Option { + T::get_attr(self, name) + } + + fn attributes(&self) -> Box + '_> { + T::attributes(self) + } + + fn call_method(&self, state: &State, name: &str, args: &[Value]) -> Result { + T::call_method(self, state, name, args) + } + + fn call(&self, state: &State, args: &[Value]) -> Result { + T::call(self, state, args) + } +}