Less verbose Debug impl for Element

This commit is contained in:
Laurenz 2023-10-27 13:00:48 +02:00
parent e182777133
commit fa81c3ece0

View File

@ -1,7 +1,7 @@
use ecow::EcoString; use ecow::EcoString;
use std::any::TypeId; use std::any::TypeId;
use std::cmp::Ordering; use std::cmp::Ordering;
use std::fmt::Debug; use std::fmt::{self, Debug, Formatter};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
@ -11,7 +11,7 @@ use crate::eval::{cast, Args, Dict, Func, ParamInfo, Repr, Scope, Value, Vm};
use crate::util::Static; use crate::util::Static;
/// A document element. /// A document element.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] #[derive(Copy, Clone, Eq, PartialEq, Hash)]
pub struct Element(Static<NativeElementData>); pub struct Element(Static<NativeElementData>);
impl Element { impl Element {
@ -94,6 +94,12 @@ impl Element {
} }
} }
impl Debug for Element {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
f.pad(self.name())
}
}
impl Repr for Element { impl Repr for Element {
fn repr(&self) -> EcoString { fn repr(&self) -> EcoString {
self.name().into() self.name().into()