glossa_shared/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![cfg_attr(__unstable_doc, feature(doc_auto_cfg, doc_notable_trait))]
3
4extern crate alloc;
5// -----
6
7pub use compact_str::{
8  CompactString as MiniStr, ToCompactString, format_compact as fmt_compact,
9};
10
11mod phf_tuple_key;
12pub use phf_tuple_key::PhfTupleKey;
13pub mod phf_triple_key;
14pub use phf_triple_key::PhfTripleKey;
15
16#[cfg(feature = "smallvec")]
17pub mod small_list;
18
19// -----
20#[cfg(feature = "type-aliases")]
21mod aliases;
22
23#[cfg(feature = "type-aliases")]
24pub use aliases::type_aliases;
25// -----
26#[cfg(feature = "type-aliases")]
27pub use glossa_dsl;
28#[cfg(feature = "type-aliases")]
29pub use lang_id;
30// -----
31#[cfg(feature = "phf")]
32pub use phf;
33#[cfg(feature = "type-aliases")]
34pub use tap;
35
36// -----
37
38#[cfg(feature = "phf")]
39pub type PhfL10nOrderedMap = phf::OrderedMap<PhfTupleKey<'static>, &'static str>;
40
41#[cfg(feature = "phf")]
42pub type PhfL10nAllInOneMap = phf::OrderedMap<PhfTripleKey<'static>, &'static str>;
43// -----
44
45#[cfg(feature = "decode")]
46pub mod decode;
47
48#[cfg(all(feature = "decode", feature = "std"))]
49pub mod load_bincode;
50
51#[cfg(feature = "std")]
52pub mod display {
53  use core::fmt::Debug;
54
55  /// => `println!("{msg}");`
56  pub fn puts<T: core::fmt::Display>(msg: &T) {
57    println!("{msg}")
58  }
59
60  /// => `println!("{debug_msg:?}");`
61  ///
62  /// > To print debug information to stderr, use [`eputs_dbg`] rather than
63  /// > `puts_dbg`.
64  pub fn puts_dbg<T: Debug>(debug_msg: &T) {
65    println!("{debug_msg:?}")
66  }
67
68  /// => `eprintln!("{msg}");`
69  pub fn eputs<T: core::fmt::Display>(msg: &T) {
70    eprintln!("{msg}")
71  }
72
73  /// => `eprintln!("{debug_msg:?}");`
74  pub fn eputs_dbg<T: Debug>(debug_msg: &T) {
75    eprintln!("{debug_msg:?}")
76  }
77}