1use short_id::{id, short_id, ShortId};
2#[cfg(feature = "std")]
3use short_id::{ordered_id, short_id_ordered};
4
5fn main() {
6 println!("=== Functions ===");
7
8 let random_id = short_id();
10 println!("short_id(): {random_id}");
11
12 #[cfg(feature = "std")]
14 {
15 let ordered = short_id_ordered();
16 println!("short_id_ordered(): {ordered}");
17 }
18
19 println!("\n=== Macros ===");
20
21 let macro_id = id!();
23 println!("id!(): {macro_id}");
24
25 #[cfg(feature = "std")]
26 {
27 let macro_ordered = ordered_id!();
28 println!("ordered_id!(): {macro_ordered}");
29 }
30
31 println!("\n=== Typed Wrapper ===");
32
33 let typed_random = ShortId::random();
35 println!("ShortId::random(): {typed_random}");
36
37 #[cfg(feature = "std")]
38 {
39 let typed_ordered = ShortId::ordered();
40 println!("ShortId::ordered(): {typed_ordered}");
41 }
42
43 let s: String = typed_random.clone().into();
45 println!("\nConverted to String: {s}");
46 println!("Using as_str(): {}", typed_random.as_str());
47 println!("Using AsRef<str>: {}", typed_random.as_ref());
48}