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
use core::cmp::Ordering;

use crate::alloc::String;
use crate::module::InstallWith;
use crate::runtime::RawStr;

/// The trait used for something that can be statically named.
pub trait Named {
    /// The generic name of the named thing.
    const BASE_NAME: RawStr;

    /// The exact type name
    fn full_name() -> ::rust_alloc::boxed::Box<str> {
        (*Self::BASE_NAME).into()
    }
}

impl Named for String {
    const BASE_NAME: RawStr = RawStr::from_str("String");
}

impl Named for &str {
    const BASE_NAME: RawStr = RawStr::from_str("String");
}

impl InstallWith for String {}

impl Named for i64 {
    const BASE_NAME: RawStr = RawStr::from_str("i64");
}

impl InstallWith for i64 {}

impl Named for f64 {
    const BASE_NAME: RawStr = RawStr::from_str("f64");
}

impl InstallWith for f64 {}

impl Named for u8 {
    const BASE_NAME: RawStr = RawStr::from_str("u8");
}

impl InstallWith for u8 {}

impl Named for char {
    const BASE_NAME: RawStr = RawStr::from_str("char");
}

impl InstallWith for char {}

impl Named for bool {
    const BASE_NAME: RawStr = RawStr::from_str("bool");
}

impl InstallWith for bool {}

impl Named for Ordering {
    const BASE_NAME: RawStr = RawStr::from_str("Ordering");
}

impl InstallWith for Ordering {}