1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Trait detection logic without using specialization.
//!
//! Inspired by the [impls](https://github.com/nvzqz/impls#how-it-works) crate.
//!
//! [`DebugDetector`] implements the method `as_debug` twice.
//! Once as a conditionally implemented inherent method always returning `Some(&dyn Debug)` and once as a trait method always returning `None`.
//!
//! An inherent method has priority over a trait method of the same name.
//!
//! Using `DebugDetector::<SomeType>::as_debug(&something)` then acts as a trait detector.
//!
//! Note that if `SomeType` is generic the detector won't work.
use Debug;
/// Fallback trait implemented by DebugDetector.
/// Zero size struct, acting as a trait Detector.
;