#debugging #inspect #inspection #popular #structures #data #combinator

inspector

General purpose inspection for popular data structures

7 releases

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

#1898 in Data structures

47 downloads per month
Used in 3 crates

Apache-2.0 OR MIT

14KB
252 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