Expand description
This module contains a simple wrapper for formatting Display
objects as Debug
and an extension method that can be called on strings.
Mainly useful for testing.
§Example:
use ast2str::utils::{DisplayAsDebugWrapper, AstToStrExt};
assert_eq!(format!("{:?}", "foo".with_display_as_debug_wrapper()), "foo");
assert_eq!(format!("{:?}", "foo"), "\"foo\"");
assert_eq!(format!("{:?}", DisplayAsDebugWrapper("foo")), "foo");
Structs§
- Display
AsDebug Wrapper - Wraps a type that implements
Display
and provides aDebug
implementation that callsDisplay::fmt
.
Traits§
- AstTo
StrExt - This trait provides a convenience method for wrapping types that implement
Display
withDisplayAsDebugWrapper
. Implemented forString
,str
, andCow
by default.