]> git.lizzy.rs Git - rust.git/blob - library/core/benches/str/corpora.rs
Merge commit 'd822110d3b5625b9dc80ccc442e06fc3cc851d76' into clippyup
[rust.git] / library / core / benches / str / corpora.rs
1 //! Exposes a number of modules with different kinds of strings.
2 //!
3 //! Each module contains `&str` constants named `TINY`, `SMALL`, `MEDIUM`,
4 //! `LARGE`, and `HUGE`.
5 //!
6 //! - The `TINY` string is generally around 8 bytes.
7 //! - The `SMALL` string is generally around 30-40 bytes.
8 //! - The `MEDIUM` string is generally around 600-700 bytes.
9 //! - The `LARGE` string is the `MEDIUM` string repeated 8x, and is around 5kb.
10 //! - The `HUGE` string is the `LARGE` string repeated 8x (or the `MEDIUM`
11 //!   string repeated 64x), and is around 40kb.
12 //!
13 //! Except for `mod emoji` (which is just a bunch of emoji), the strings were
14 //! pulled from (localizations of) rust-lang.org.
15
16 macro_rules! repeat8 {
17     ($s:expr) => {
18         concat!($s, $s, $s, $s, $s, $s, $s, $s)
19     };
20 }
21
22 macro_rules! define_consts {
23     ($s:literal) => {
24         pub const MEDIUM: &str = $s;
25         pub const LARGE: &str = repeat8!($s);
26         pub const HUGE: &str = repeat8!(repeat8!(repeat8!($s)));
27     };
28 }
29
30 pub mod en {
31     pub const TINY: &str = "Mary had";
32     pub const SMALL: &str = "Mary had a little lamb, Little lamb";
33     define_consts! {
34         "Rust is blazingly fast and memory-efficient: with no runtime or garbage
35          collector, it can power performance-critical services, run on embedded
36          devices, and easily integrate with other languages.  Rust’s rich type system
37          and ownership model guarantee memory-safety and thread-safety — enabling you
38          to eliminate many classes of bugs at compile-time.  Rust has great
39          documentation, a friendly compiler with useful error messages, and top-notch
40          tooling — an integrated package manager and build tool, smart multi-editor
41          support with auto-completion and type inspections, an auto-formatter, and
42          more."
43     }
44 }
45
46 pub mod zh {
47     pub const TINY: &str = "速度惊";
48     pub const SMALL: &str = "速度惊人且内存利用率极高";
49     define_consts! {
50         "Rust   速度惊人且内存利用率极高。由于\
51          没有运行时和垃圾回收,它能够胜任对性能要\
52          求特别高的服务,可以在嵌入式设备上运行,\
53          还能轻松和其他语言集成。Rust 丰富的类型\
54          系统和所有权模型保证了内存安全和线程安全,\
55          让您在编译期就能够消除各种各样的错误。\
56          Rust 拥有出色的文档、友好的编译器和清晰\
57          的错误提示信息, 还集成了一流的工具——\
58          包管理器和构建工具, 智能地自动补全和类\
59          型检验的多编辑器支持, 以及自动格式化代\
60          码等等。"
61     }
62 }
63
64 pub mod ru {
65     pub const TINY: &str = "Сотни";
66     pub const SMALL: &str = "Сотни компаний по";
67     define_consts! {
68         "Сотни компаний по всему миру используют Rust в реальных\
69          проектах для быстрых кросс-платформенных решений с\
70          ограниченными ресурсами. Такие проекты, как Firefox,\
71          Dropbox и Cloudflare, используют Rust. Rust отлично\
72          подходит как для стартапов, так и для больших компаний,\
73          как для встраиваемых устройств, так и для масштабируемых\
74          web-сервисов. Мой самый большой комплимент Rust."
75     }
76 }
77
78 pub mod emoji {
79     pub const TINY: &str = "😀😃";
80     pub const SMALL: &str = "😀😃😄😁😆😅🤣😂🙂🙃😉😊😇🥰😍🤩😘";
81     define_consts! {
82         "😀😃😄😁😆😅🤣😂🙂🙃😉😊😇🥰😍🤩😘😗☺😚😙🥲😋😛😜🤪😝🤑🤗🤭🤫🤔🤐🤨😐😑😶😶‍🌫️😏😒\
83          🙄😬😮‍💨🤥😌😔😪🤤😴😷🤒🤕🤢🤮🤧🥵🥶🥴😵😵‍💫🤯��🥳🥸😎🤓🧐😕😟🙁☹😮😯😲😳🥺😦😧😨\
84          😰😥😢😭😱😖😣😞😓😩😫🥱😤😡😠🤬😈👿💀☠💩🤡👹👺👻👽👾🤖😺😸😹😻😼😽🙀😿😾🙈🙉🙊\
85          💋💌💘💝💖💗💓��💕💟❣💔❤️‍🔥❤️‍🩹❤🧡💛💚💙💜🤎🖤🤍💯💢💥💫💦💨🕳💬👁️‍🗨️🗨🗯💭💤👋\
86          🤚🖐✋🖖👌🤌🤏✌"
87     }
88 }