abi_stable/
sabi_trait.rs

1//! Contains items related to the [`#[sabi_trait]`](macro@crate::sabi_trait) attribute.
2
3#[doc(hidden)]
4pub mod reexports {
5
6    pub use std::ops::{Deref as __DerefTrait, DerefMut as __DerefMutTrait};
7
8    pub use crate::{
9        marker_type::ErasedObject as __ErasedObject,
10        pointer_trait::GetPointerKind as __GetPointerKind,
11    };
12
13    pub mod __sabi_re {
14        pub use abi_stable::{
15            erased_types::{
16                DynTrait, MakeVTable as MakeDynTraitVTable, VTable_Ref as DynTraitVTable_Ref,
17            },
18            extern_fn_panic_handling,
19            marker_type::{
20                NonOwningPhantom, SyncSend, SyncUnsend, UnsafeIgnoredType, UnsyncSend, UnsyncUnsend,
21            },
22            pointer_trait::{AsMutPtr, AsPtr, CanTransmuteElement, OwnedPointer, TransmuteElement},
23            prefix_type::{PrefixRef, PrefixTypeTrait, WithMetadata},
24            sabi_trait::{
25                robject::RObject,
26                vtable::{GetRObjectVTable, RObjectVtable, RObjectVtable_Ref},
27            },
28            sabi_types::{MovePtr, RMut, RRef},
29            std_types::RBox,
30            traits::IntoInner,
31            utils::take_manuallydrop,
32        };
33
34        pub use core_extensions::{utils::transmute_ignore_size, TypeIdentity};
35
36        pub use std::{
37            marker::PhantomData,
38            mem::{transmute, ManuallyDrop},
39            ops::Deref,
40            ptr,
41        };
42    }
43}
44
45/// A prelude for modules using `#[sabi_trait]` generated traits/trait objects.
46pub mod prelude {
47    pub use crate::type_level::downcasting::{TD_CanDowncast, TD_Opaque};
48}
49
50pub use crate::type_level::downcasting::{TD_CanDowncast, TD_Opaque};
51
52#[cfg(any(test, feature = "sabi_trait_examples"))]
53pub mod examples;
54
55pub mod doc_examples;
56
57mod robject;
58
59#[doc(hidden)]
60pub mod vtable;
61
62#[cfg(test)]
63pub mod tests;
64
65#[cfg(all(test, not(feature = "only_new_tests")))]
66pub mod test_supertraits;
67
68use std::{
69    fmt::{Debug, Display},
70    marker::PhantomData,
71};
72
73use self::reexports::__sabi_re::*;
74
75pub use self::robject::{RObject, ReborrowBounds, UneraseError};
76
77use crate::{erased_types::c_functions, marker_type::ErasedObject, sabi_types::MaybeCmp};