Skip to main content

oxilean_runtime/closure/
closure_traits.rs

1//! # Closure - Trait Implementations
2//!
3//! This module contains trait implementations for `Closure`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Display`
8//!
9//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
10
11use super::types::Closure;
12use std::fmt;
13
14impl fmt::Display for Closure {
15    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16        if let Some(ref name) = self.name {
17            write!(
18                f,
19                "<closure {} arity={} env={}>",
20                name,
21                self.arity,
22                self.env.len()
23            )
24        } else {
25            write!(
26                f,
27                "<closure {} arity={} env={}>",
28                self.fn_ptr,
29                self.arity,
30                self.env.len()
31            )
32        }
33    }
34}