1#![cfg_attr(not(feature = "std"), no_std)]
2
3pub mod fmt;
12pub mod indentable;
13
14#[cfg(feature = "std")]
15pub mod io;
16
17trait Inspect<T> {
18 fn inspect(self, func: impl FnOnce(&T)) -> Self;
19}
20
21impl<T> Inspect<T> for Option<T> {
22 #[inline]
23 fn inspect(self, func: impl FnOnce(&T)) -> Self {
24 if let Some(ref value) = self {
25 func(value)
26 }
27
28 self
29 }
30}
31
32impl<T, E> Inspect<T> for Result<T, E> {
33 #[inline]
34 fn inspect(self, func: impl FnOnce(&T)) -> Self {
35 if let Ok(ref value) = self {
36 func(value)
37 }
38
39 self
40 }
41}