Skip to main content

boa_engine/value/display/
mod.rs

1use std::fmt::{self, Display};
2
3use crate::JsValue;
4
5mod arguments;
6mod array;
7mod map;
8mod object;
9mod primitives;
10mod set;
11mod typed_array;
12mod value;
13
14/// This object is used for displaying a `Value`.
15#[derive(Debug, Clone, Copy)]
16pub struct ValueDisplay<'value> {
17    pub(super) value: &'value JsValue,
18    pub(super) internals: bool,
19}
20
21impl ValueDisplay<'_> {
22    /// Display internal information about value.
23    ///
24    /// By default this is `false`.
25    #[inline]
26    #[must_use]
27    pub const fn internals(mut self, yes: bool) -> Self {
28        self.internals = yes;
29        self
30    }
31}
32
33impl Display for ValueDisplay<'_> {
34    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
35        value::log_value_to(f, self.value, self.internals, true)
36    }
37}