From 01b945b9814b9dc546e783a6dab66e4f7fe49786 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 13 Sep 2021 11:22:53 +0700 Subject: Write missing docs and `Debug` implementations for `web` --- web/src/command.rs | 10 ++++++++++ web/src/command/action.rs | 10 ++++++++++ web/src/lib.rs | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/web/src/command.rs b/web/src/command.rs index f222795d..33e49e70 100644 --- a/web/src/command.rs +++ b/web/src/command.rs @@ -2,6 +2,8 @@ mod action; pub use action::Action; +use std::fmt; + #[cfg(target_arch = "wasm32")] use std::future::Future; @@ -60,3 +62,11 @@ impl Command { command.actions() } } + +impl fmt::Debug for Command { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let Command(command) = self; + + command.fmt(f) + } +} diff --git a/web/src/command/action.rs b/web/src/command/action.rs index cf384f07..c0223e50 100644 --- a/web/src/command/action.rs +++ b/web/src/command/action.rs @@ -2,6 +2,8 @@ pub enum Action { Future(iced_futures::BoxFuture), } +use std::fmt; + impl Action { /// Applies a transformation to the result of a [`Command`]. #[cfg(target_arch = "wasm32")] @@ -16,3 +18,11 @@ impl Action { } } } + +impl fmt::Debug for Action { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Future(_) => write!(f, "Action::Future"), + } + } +} diff --git a/web/src/lib.rs b/web/src/lib.rs index ec2bd178..5bbd2ee6 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -50,8 +50,8 @@ //! [`wasm-pack`]: https://github.com/rustwasm/wasm-pack //! [`wasm-bindgen`]: https://github.com/rustwasm/wasm-bindgen //! [`tour` example]: https://github.com/hecrj/iced/tree/0.3/examples/tour -//#![deny(missing_docs)] -//#![deny(missing_debug_implementations)] +#![deny(missing_docs)] +#![deny(missing_debug_implementations)] #![deny(unused_results)] #![forbid(unsafe_code)] #![forbid(rust_2018_idioms)] -- cgit