Skip to main content

Crate diagnosticism

Crate diagnosticism 

Source
Expand description

Simple diagnostics utilities for Rust — part of the cross-language Diagnosticism family.

Diagnosticism offers small, focused helpers that extend the standard library for logging, profiling, and debug output. The project is implemented in several languages; each port exposes facilities that are useful and idiomatic in that environment. (See Diagnosticism.Python for a wider API, including tracing and callstack capture.)

In Rust, this crate focuses on three areas:

For example, Ellipsis in a custom Debug implementation can elide fields in terse "{:?}" output while still including them in alternate "{:#?}" form.

§Installation

Reference in Cargo.toml in the usual way:

diagnosticism = { version = "0" }

§Components

§Types and functions

The following are re-exported at the crate root (and also available in diagnostics):

§Macros (crate root)

File, line, and function helpers are exported at the crate root:

§Redacting Debug fields

Both Ellipsis and Password are field placeholders in custom Debug implementations; neither reads the underlying value.

  • Ellipsis"..." for verbose, non-sensitive elision; often used with {:#?} alternate output;
  • Password — a masked * run for sensitive values; use Password::new for width;

§Examples

use diagnosticism::Ellipsis;

println!("redacted: {:?}", Ellipsis::default());

Further examples are provided in the repository examples directory and in the project README.

Re-exports§

pub use diagnostics::doom_scope;
pub use diagnostics::nanoseconds_to_string;
pub use diagnostics::DebugSqueezer;
pub use diagnostics::DoomGram;
pub use diagnostics::Ellipsis;
pub use diagnostics::NanosecondsStr;
pub use diagnostics::Password;

Modules§

diagnostics

Macros§

fileline
Expands to the file name and line number in which it was invoked.
filelinefunction
Expands to the file name and line number and function name in which it was invoked.
filelinefunction_fully_qualified_name
Expands to the file name, line number, and fully-qualified function name at the call site.
function_fully_qualified_name
Expands to the fully-qualified name of the function in which it was invoked.
function_name_only
Expands to the unqualified name of the function in which it was invoked.
type_name_only
Expands to the unqualified std::any::type_name of the given type.