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
#![warn(clippy::pedantic, clippy::nursery)]
#![allow(clippy::doc_markdown)]
#![deny(missing_docs, rustdoc::broken_intra_doc_links)]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/azzamsa/dryip-of-rust/master/docs/logo.png
"
)]
#![doc(
html_favicon_url = "https://raw.githubusercontent.com/azzamsa/dryip-of-rust/master/docs/favicon.ico
"
)]
pub mod arrays;
pub mod dates;
pub mod maths;
pub mod strings;
#[must_use]
pub fn sorted(word: &str) -> String {
let mut chars_ = word.chars().collect::<Vec<char>>();
chars_.sort_unstable();
chars_.iter().collect::<String>()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_sorted() {
assert_eq!("aaagmnr", sorted("anagram"));
assert_eq!("aceimn", sorted("iceman"));
}
}