1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Provides stable const implementations for some things missing from the standard library.
//!
//! Currently implemented are
//! - Functions in [`result`](crate::result) to unwrap [`Result`](core::result::Result)s with generics or drop glue
//! - Functions in the [`concat`](crate::concat) module to concat const strings and byte slices.
//! - [`destruct_tuple`](crate::destruct_tuple) to destructure tuples with generic types or types with drop glue in them
//! - [`nonnull_from`](crate::mem::nonnull_from) to create [`NonNull`](core::ptr::NonNull)s from mutable and regular references
//! conveniently
//! - [`man_drop_ref`](crate::mem::man_drop_ref)/[`man_drop_mut`](crate::mem::man_drop_mut) as a workaround for the lack of const
//! [`Deref`](core::ops::Deref) implementations
//! - Functions in [`slice`](crate::slice) to take subslices using ranges
pub extern crate type_const;
pub use ;
/// Allows destructuring tuples in `const` contexts, regardless of items having drop glue.
///
/// This is mainly useful to allow generic functions to return tuples without being then stuck
/// without a way to pull them back apart.
///
/// # Example
/// ```
/// use const_util::*;
/// const fn pair_to_arr<T>(pair: (T, T)) -> [T; 2] {
/// destruct_tuple! { a, b in pair }
/// [a, b]
/// }
/// assert_eq!(
/// pair_to_arr((String::from("ABC"), String::new())),
/// ["ABC", ""],
/// );
/// ```