devela/text/str/
reexports.rs

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
// devela::text::str:reexports
//
//! String related re-exports.
//!
//! Reexport the *const-str* crate macros related to string slices,
//! prefixed with `str_` and with a new first line of documentation.
//

use crate::{impl_cdef, reexport};

impl_cdef!["" => &str];
#[cfg(all(not(feature = "safe_text"), feature = "unsafe_str"))]
#[cfg_attr(feature = "nightly_doc", doc(cfg(feature = "unsafe_str")))]
impl crate::ConstDefault for &mut str {
    // SAFETY: The empty string is valid UTF-8.
    const DEFAULT: Self = unsafe { ::core::str::from_utf8_unchecked_mut(&mut []) };
}
#[cfg(feature = "alloc")]
impl_cdef![Self::new() => String];

/* from other modules */

pub use crate::CStr;
#[cfg(feature = "alloc")]
pub use crate::CString;
#[cfg(feature = "std")]
crate::items! { pub use crate::{OsStr, OsString}; }

/* core */

reexport! { rust: core::str,
    doc: "Parse a value from a string.",
    FromStr
}

/* alloc */

reexport! { rust: alloc::string,
    doc: "A UTF-8–encoded, growable string.",
    String
}
reexport! { rust: alloc::string,
    doc: "A trait for converting a value to a [`String`].",
    ToString
}