devela/sys/mem/
reexports.rs

1// devela::sys::mem::reexports
2//
3//! Reexported items from `core`.
4//
5
6#[cfg(all(doc, feature = "alloc"))]
7use super::Boxed;
8use crate::reexport;
9
10#[cfg(feature = "alloc")]
11crate::impl_cdef![<T: ConstDefault> Self::new() => RcWeak<T>];
12
13#[doc(inline)]
14pub use crate::Sized;
15
16/* borrow */
17
18reexport! { rust: core::borrow,
19    doc: "A trait for borrowing data.",
20    Borrow
21}
22reexport! { rust: core::borrow,
23    doc: "A trait for mutably borrowing data.",
24    BorrowMut
25}
26reexport! { rust: alloc::borrow,
27    doc: "A clone-on-write smart pointer.",
28    Cow
29}
30reexport! { rust: alloc::borrow,
31    doc: "A generalization of Clone to borrowed data.",
32    ToOwned
33}
34
35/* box */
36
37reexport! { rust: alloc::boxed,
38    doc: "A pointer type that uniquely owns a heap allocation of type `T`.
39
40It is used as the underlying [`Storage`][super::Storage] for the [`Boxed`] marker struct,
41just as a [`BareBox`][super::BareBox] is used as the storage for [`Bare`].
42
43A special magic property of `Box` is that it allows moving with [*boxed], unlike
44other `Deref` types. It is hoped that an eventual `DerefMove` trait will make it
45possible for other types to opt in to move-from-deref.
46",
47    Box
48}
49
50/* mem */
51
52reexport! { rust: core::mem,
53    doc: "A wrapper to inhibit compiler from automatically calling `T`’s destructor.",
54    ManuallyDrop
55}
56reexport! { rust: core::mem,
57    doc: "A wrapper type to construct uninitialized instances of `T`.",
58    MaybeUninit
59}
60reexport! { rust: core::mem,
61    doc: "Opaque type representing the discriminant of an enum.",
62    Discriminant
63}
64
65reexport! { rust: core::mem,
66    doc: "Expands to the offset in bytes of a field from the beginning of the given type.",
67    offset_of
68}
69
70// NOTE: can't namespace this in `Mem`.
71reexport! { rust: core::mem,
72    doc: "Reinterprets the bits of a value of one type as another type.",
73    transmute
74}
75
76/* pin */
77
78reexport! { rust: core::pin,
79    doc: "Constructs a <code>[Pin]<[&mut] T></code>, by pinning a `value: T` locally.",
80    pin
81}
82reexport! { rust: core::pin,
83    doc: "A pointer which pins its pointee in place.",
84    Pin
85}
86
87/* rc */
88
89reexport! { rust: alloc::rc,
90    doc: "A single-threaded reference-counting pointer.",
91    Rc
92}
93reexport! { rust: alloc::rc,
94    doc: "A version of `Rc` that holds a non-owning reference to the managed allocation.",
95    @Weak as RcWeak
96}