try_drop/handlers/fallback/
mod.rs

1//! Manage the fallback handler.
2
3#[macro_use]
4mod macros;
5
6#[cfg(feature = "global")]
7pub mod global;
8
9#[cfg(feature = "thread-local")]
10pub mod thread_local;
11
12#[cfg(all(feature = "global", feature = "thread-local"))]
13pub mod shim;
14
15mod private {
16    pub trait Sealed {}
17}
18
19use crate::handlers::common::handler::CommonHandler;
20use crate::handlers::common::proxy::TheGreatAbstracter;
21use crate::handlers::common::{Fallback, Scope};
22use std::marker::PhantomData;
23
24/// The default thing to do when the fallback handler is not initialized.
25#[cfg(not(feature = "ds-panic"))]
26pub type DefaultOnUninit = crate::handlers::on_uninit::PanicOnUninit;
27
28/// The default thing to do when the fallback handler is not initialized.
29#[cfg(feature = "ds-panic")]
30pub type DefaultOnUninit = crate::handlers::on_uninit::UseDefaultOnUninit;
31
32type Abstracter<S> = TheGreatAbstracter<Fallback, S>;
33
34impl<S: Scope> CommonHandler<DefaultOnUninit, S, Fallback> {
35    pub const DEFAULT: Self = Self {
36        extra_data: (),
37        _scope: PhantomData,
38    };
39}
40
41impl<S: Scope> Default for CommonHandler<DefaultOnUninit, S, Fallback> {
42    fn default() -> Self {
43        Self::DEFAULT
44    }
45}