From ef843b9e5a1d4d112b604f8e98e081f1ed607341 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 1 Feb 2020 02:46:53 -0800 Subject: [PATCH] Add a `Debug` implementation for `wsmtime::Config` Handy to have in some situations! --- crates/api/src/runtime.rs | 15 +++++++++++++++ crates/jit/src/context.rs | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/api/src/runtime.rs b/crates/api/src/runtime.rs index 3475261ce9..a930cac462 100644 --- a/crates/api/src/runtime.rs +++ b/crates/api/src/runtime.rs @@ -1,5 +1,6 @@ use anyhow::Result; use std::cell::RefCell; +use std::fmt; use std::rc::Rc; use std::sync::Arc; use wasmtime_environ::settings::{self, Configurable}; @@ -223,6 +224,20 @@ impl Default for Config { } } +impl fmt::Debug for Config { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Config") + .field("debug_info", &self.debug_info) + .field("strategy", &self.strategy) + .field("features", &self.features) + .field( + "flags", + &settings::Flags::new(self.flags.clone()).to_string(), + ) + .finish() + } +} + /// Possible Compilation strategies for a wasm module. /// /// This is used as an argument to the [`Config::strategy`] method. diff --git a/crates/jit/src/context.rs b/crates/jit/src/context.rs index 42dbae8d52..30922d4967 100644 --- a/crates/jit/src/context.rs +++ b/crates/jit/src/context.rs @@ -26,7 +26,7 @@ pub enum ContextError { } /// The collection of features configurable during compilation -#[derive(Clone, Default)] +#[derive(Clone, Default, Debug)] pub struct Features { /// marks whether the proposed thread feature is enabled or disabled pub threads: bool,