genco/tokens/
internal.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
use alloc::boxed::Box;

use crate::lang::Lang;
use crate::tokens::{from_fn, FormatInto};

/// Add a language item directly.
///
/// This must only be used by the [impl_lang!] macro.
///
/// [impl_lang!]: crate::impl_lang!
#[doc(hidden)]
#[inline]
pub fn __lang_item<L>(item: L::Item) -> impl FormatInto<L>
where
    L: Lang,
{
    from_fn(|t| {
        t.lang_item(Box::new(item));
    })
}

/// Register a language item directly.
///
/// This must only be used by the [impl_lang!] macro.
///
/// [impl_lang!]: crate::impl_lang!
#[doc(hidden)]
#[inline]
pub fn __lang_item_register<L>(item: L::Item) -> impl FormatInto<L>
where
    L: Lang,
{
    from_fn(|t| {
        t.lang_item_register(Box::new(item));
    })
}