Skip to main content

announce_std/
clone.rs

1//! announce mocks of `clone` traits (hand-written).
2
3#[allow(unused_imports)]
4use announce::announce;
5
6/// announce mock of [`::core::clone::Clone`]: invoke `Clone!` 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::clone::Clone)]
12pub trait Clone: ::core::marker::Sized {
13    fn clone(&self) -> Self;
14    fn clone_from(&mut self, source: &Self) {
15        ::core::unimplemented!()
16    }
17}
18
19#[cfg(announce_std_rust_1_94)]
20#[doc(hidden)]
21pub mod __real {
22    pub use ::core::clone::Clone;
23}
24#[cfg(announce_std_rust_1_94)]
25#[doc(no_inline)]
26pub use self::__real::*;
27
28#[cfg(not(announce_std_rust_1_94))]
29/// Fallback for rustc < 1.94: a blanket subtrait of [`::core::clone::Clone`], usable in bounds.
30pub trait Clone: ::core::clone::Clone {}
31#[cfg(not(announce_std_rust_1_94))]
32impl<__T: ?::core::marker::Sized + ::core::clone::Clone> Clone for __T {}