Skip to content

Commit

Permalink
Write missing docs and Debug implementations for web
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Sep 13, 2021
1 parent a77beaf commit 0910fdf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions web/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ mod action;

pub use action::Action;

use std::fmt;

#[cfg(target_arch = "wasm32")]
use std::future::Future;

Expand Down Expand Up @@ -60,3 +62,11 @@ impl<T> Command<T> {
command.actions()
}
}

impl<T> fmt::Debug for Command<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Command(command) = self;

command.fmt(f)
}
}
10 changes: 10 additions & 0 deletions web/src/command/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ pub enum Action<T> {
Future(iced_futures::BoxFuture<T>),
}

use std::fmt;

impl<T> Action<T> {
/// Applies a transformation to the result of a [`Command`].
#[cfg(target_arch = "wasm32")]
Expand All @@ -16,3 +18,11 @@ impl<T> Action<T> {
}
}
}

impl<T> fmt::Debug for Action<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Future(_) => write!(f, "Action::Future"),
}
}
}
4 changes: 2 additions & 2 deletions web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 0910fdf

Please sign in to comment.