#[allow(unused_imports)]
use wasm_bindgen::prelude::*;
#[allow(unused_imports)]
use js_sys::*;
pub trait PromiseExt {
type Output;
fn into_future(self) -> wasm_bindgen_futures::JsFuture<Self::Output>;
}
impl<T: 'static + wasm_bindgen::convert::FromWasmAbi> PromiseExt for js_sys::Promise<T> {
type Output = T;
fn into_future(self) -> wasm_bindgen_futures::JsFuture<T> {
wasm_bindgen_futures::JsFuture::from(self)
}
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub type ConsoleOptions;
#[wasm_bindgen(method, getter)]
pub fn stdout(this: &ConsoleOptions) -> Object;
#[wasm_bindgen(method, setter)]
pub fn set_stdout(this: &ConsoleOptions, val: &Object);
#[wasm_bindgen(method, getter)]
pub fn stderr(this: &ConsoleOptions) -> Option<Object>;
#[wasm_bindgen(method, setter)]
pub fn set_stderr(this: &ConsoleOptions, val: Option<&Object>);
#[wasm_bindgen(method, getter, js_name = "ignoreErrors")]
pub fn ignore_errors(this: &ConsoleOptions) -> Option<bool>;
#[wasm_bindgen(method, setter, js_name = "ignoreErrors")]
pub fn set_ignore_errors(this: &ConsoleOptions, val: Option<bool>);
#[wasm_bindgen(method, getter, js_name = "colorMode")]
pub fn color_mode(this: &ConsoleOptions) -> Option<JsValue>;
#[wasm_bindgen(method, setter, js_name = "colorMode")]
pub fn set_color_mode(this: &ConsoleOptions, val: Option<bool>);
#[wasm_bindgen(method, setter, js_name = "colorMode")]
pub fn set_color_mode_with_str(this: &ConsoleOptions, val: Option<&str>);
#[wasm_bindgen(method, getter, js_name = "groupIndentation")]
pub fn group_indentation(this: &ConsoleOptions) -> Option<f64>;
#[wasm_bindgen(method, setter, js_name = "groupIndentation")]
pub fn set_group_indentation(this: &ConsoleOptions, val: Option<f64>);
}
impl ConsoleOptions {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
#[allow(unused_imports)]
use wasm_bindgen::JsCast;
JsCast::unchecked_into(js_sys::Object::new())
}
pub fn builder() -> ConsoleOptionsBuilder {
ConsoleOptionsBuilder {
inner: Self::new(),
required: 1u64,
}
}
}
pub struct ConsoleOptionsBuilder {
inner: ConsoleOptions,
required: u64,
}
#[allow(unused_mut)]
impl ConsoleOptionsBuilder {
pub fn stdout(mut self, val: &Object) -> Self {
self.inner.set_stdout(val);
self.required &= 18446744073709551614u64;
self
}
pub fn stderr(mut self, val: Option<&Object>) -> Self {
self.inner.set_stderr(val);
self
}
pub fn ignore_errors(mut self, val: Option<bool>) -> Self {
self.inner.set_ignore_errors(val);
self
}
pub fn color_mode(mut self, val: Option<bool>) -> Self {
self.inner.set_color_mode(val);
self
}
pub fn color_mode_with_str(mut self, val: Option<&str>) -> Self {
self.inner.set_color_mode_with_str(val);
self
}
pub fn group_indentation(mut self, val: Option<f64>) -> Self {
self.inner.set_group_indentation(val);
self
}
pub fn build(self) -> Result<ConsoleOptions, JsValue> {
if self.required != 0 {
let mut missing = Vec::new();
if self.required & 1u64 != 0 {
missing.push("missing required property `stdout`");
}
return Err(
JsValue::from_str(
&format!("{}: {}", stringify!(ConsoleOptions), missing.join(", ")),
),
);
}
Ok(self.inner)
}
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub type Console;
#[wasm_bindgen(constructor, catch)]
pub fn new(stdout: &Object) -> Result<Console, JsValue>;
#[wasm_bindgen(constructor, catch, js_name = "Console")]
pub fn new_with_stderr(stdout: &Object, stderr: &Object) -> Result<Console, JsValue>;
#[wasm_bindgen(constructor, catch, js_name = "Console")]
pub fn new_with_stderr_and_ignore_errors(
stdout: &Object,
stderr: &Object,
ignore_errors: bool,
) -> Result<Console, JsValue>;
#[wasm_bindgen(method, variadic)]
pub fn assert(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "assert")]
pub fn try_assert(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic, js_name = "assert")]
pub fn assert_with_condition(this: &Console, condition: bool, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "assert")]
pub fn try_assert_with_condition(
this: &Console,
condition: bool,
data: &[JsValue],
) -> Result<(), JsValue>;
#[wasm_bindgen(method)]
pub fn clear(this: &Console);
#[wasm_bindgen(method, catch, js_name = "clear")]
pub fn try_clear(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method)]
pub fn count(this: &Console);
#[wasm_bindgen(method, catch, js_name = "count")]
pub fn try_count(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "count")]
pub fn count_with_label(this: &Console, label: &str);
#[wasm_bindgen(method, catch, js_name = "count")]
pub fn try_count_with_label(this: &Console, label: &str) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "countReset")]
pub fn count_reset(this: &Console);
#[wasm_bindgen(method, catch, js_name = "countReset")]
pub fn try_count_reset(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "countReset")]
pub fn count_reset_with_label(this: &Console, label: &str);
#[wasm_bindgen(method, catch, js_name = "countReset")]
pub fn try_count_reset_with_label(
this: &Console,
label: &str,
) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic)]
pub fn debug(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "debug")]
pub fn try_debug(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic)]
pub fn error(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "error")]
pub fn try_error(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic)]
pub fn group(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "group")]
pub fn try_group(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic, js_name = "groupCollapsed")]
pub fn group_collapsed(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "groupCollapsed")]
pub fn try_group_collapsed(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "groupEnd")]
pub fn group_end(this: &Console);
#[wasm_bindgen(method, catch, js_name = "groupEnd")]
pub fn try_group_end(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic)]
pub fn info(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "info")]
pub fn try_info(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic)]
pub fn log(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "log")]
pub fn try_log(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method)]
pub fn table(this: &Console);
#[wasm_bindgen(method, catch, js_name = "table")]
pub fn try_table(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "table")]
pub fn table_with_tabular_data(this: &Console, tabular_data: &JsValue);
#[wasm_bindgen(method, catch, js_name = "table")]
pub fn try_table_with_tabular_data(
this: &Console,
tabular_data: &JsValue,
) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "table")]
pub fn table_with_tabular_data_and_properties(
this: &Console,
tabular_data: &JsValue,
properties: &Array<JsString>,
);
#[wasm_bindgen(method, catch, js_name = "table")]
pub fn try_table_with_tabular_data_and_properties(
this: &Console,
tabular_data: &JsValue,
properties: &Array<JsString>,
) -> Result<(), JsValue>;
#[wasm_bindgen(method)]
pub fn time(this: &Console);
#[wasm_bindgen(method, catch, js_name = "time")]
pub fn try_time(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "time")]
pub fn time_with_label(this: &Console, label: &str);
#[wasm_bindgen(method, catch, js_name = "time")]
pub fn try_time_with_label(this: &Console, label: &str) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "timeEnd")]
pub fn time_end(this: &Console);
#[wasm_bindgen(method, catch, js_name = "timeEnd")]
pub fn try_time_end(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "timeEnd")]
pub fn time_end_with_label(this: &Console, label: &str);
#[wasm_bindgen(method, catch, js_name = "timeEnd")]
pub fn try_time_end_with_label(this: &Console, label: &str) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic, js_name = "timeLog")]
pub fn time_log(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "timeLog")]
pub fn try_time_log(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic, js_name = "timeLog")]
pub fn time_log_with_label(this: &Console, label: &str, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "timeLog")]
pub fn try_time_log_with_label(
this: &Console,
label: &str,
data: &[JsValue],
) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic)]
pub fn trace(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "trace")]
pub fn try_trace(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method, variadic)]
pub fn warn(this: &Console, data: &[JsValue]);
#[wasm_bindgen(method, variadic, catch, js_name = "warn")]
pub fn try_warn(this: &Console, data: &[JsValue]) -> Result<(), JsValue>;
#[wasm_bindgen(method)]
pub fn profile(this: &Console);
#[wasm_bindgen(method, catch, js_name = "profile")]
pub fn try_profile(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "profile")]
pub fn profile_with_label(this: &Console, label: &str);
#[wasm_bindgen(method, catch, js_name = "profile")]
pub fn try_profile_with_label(this: &Console, label: &str) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "profileEnd")]
pub fn profile_end(this: &Console);
#[wasm_bindgen(method, catch, js_name = "profileEnd")]
pub fn try_profile_end(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "profileEnd")]
pub fn profile_end_with_label(this: &Console, label: &str);
#[wasm_bindgen(method, catch, js_name = "profileEnd")]
pub fn try_profile_end_with_label(
this: &Console,
label: &str,
) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "timeStamp")]
pub fn time_stamp(this: &Console);
#[wasm_bindgen(method, catch, js_name = "timeStamp")]
pub fn try_time_stamp(this: &Console) -> Result<(), JsValue>;
#[wasm_bindgen(method, js_name = "timeStamp")]
pub fn time_stamp_with_label(this: &Console, label: &str);
#[wasm_bindgen(method, catch, js_name = "timeStamp")]
pub fn try_time_stamp_with_label(this: &Console, label: &str) -> Result<(), JsValue>;
}