7 releases

0.1.0 Nov 7, 2019
0.0.5 Feb 19, 2019
0.0.1 Aug 23, 2018

#2293 in Data structures

Download history 27/week @ 2024-09-08 1/week @ 2024-09-15 12/week @ 2024-09-22 3/week @ 2024-09-29 1/week @ 2024-10-13 7/week @ 2024-11-03 3/week @ 2024-11-10 3/week @ 2024-11-17 3/week @ 2024-11-24 63/week @ 2024-12-08

69 downloads per month
Used in 3 crates

Apache-2.0 OR MIT

15KB
272 lines

Inspector

Public trait for adding .inspect() method for popular data-stuctures.

Changelog

0.0.5 - "inspect-release" replaced with "debug-only". It is opt-out, rather than opt-in. By default it resembles other inspect() methods in std library.

0.0.4 - "inspect-release" feature to enable inspection in release mode. (opt-in)


lib.rs:

Crate inspector extends popular data structures (such as Option and Result) with additional methods for inspecting their payload. It is inspired by the Iterator::inspect. Since no such methods are available by default on Option and Result types, this crate implements a new traits for these types, which augment the respective types with various inspection capabilities.

Implementation and availability of each trait is guarded by the dedicated feature, so that you can choose which one is available. Sometimes you want these only for debug purposes, but prefer to always leave the code in place. Feature debug-only helps in this case. If enabled and compiled in release mode the combinators become effectively NOP. This feature does nothing in debug mode.

Features

  • debug-only - turnes the combinators into NOP in release mode
  • option - enables trait OptionInspector
  • result - enables trait ResultInspector
  • futures - enables trait FuturesInspector

Dependencies

~14KB