Skip to main content

announce_std/
default.rs

1//! announce mocks of `default` traits (hand-written).
2
3#[allow(unused_imports)]
4use announce::announce;
5
6/// announce mock of [`::core::default::Default`]: invoke `Default!` to receive its definition.
7///
8/// The real trait is available under the same path in the type namespace
9/// (from rustc 1.94, through a glob re-export, since the macro namespace holds this
10/// trampoline).
11#[announce(mock = ::core::default::Default)]
12pub trait Default: ::core::marker::Sized {
13    fn default() -> Self;
14}
15
16#[cfg(announce_std_rust_1_94)]
17#[doc(hidden)]
18pub mod __real {
19    pub use ::core::default::Default;
20}
21#[cfg(announce_std_rust_1_94)]
22#[doc(no_inline)]
23pub use self::__real::*;
24
25#[cfg(not(announce_std_rust_1_94))]
26/// Fallback for rustc < 1.94: a blanket subtrait of [`::core::default::Default`], usable in bounds.
27pub trait Default: ::core::default::Default {}
28#[cfg(not(announce_std_rust_1_94))]
29impl<__T: ?::core::marker::Sized + ::core::default::Default> Default for __T {}