]>
Commit | Line | Data |
---|---|---|
94222f64 XL |
1 | #![deny(missing_docs,trivial_casts,trivial_numeric_casts, |
2 | missing_debug_implementations, missing_copy_implementations, | |
3 | unsafe_code,unused_import_braces,unused_qualifications) | |
4 | ] | |
5 | // Copyright 2015-2017 Daniel P. Clark & array_tool Developers | |
6 | // | |
7 | // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or | |
8 | // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or | |
9 | // http://opensource.org/licenses/MIT>, at your option. This file may not be | |
10 | // copied, modified, or distributed except according to those terms. | |
11 | ||
12 | //! # Array Tool | |
13 | //! | |
14 | //! is a collection of powerful methods for working with collections. | |
15 | //! Some of the most common methods you would use on Arrays made available | |
16 | //! on Vectors. Polymorphic implementations for handling most of your use cases. | |
17 | //! | |
18 | //! In your rust files where you plan to use it put this at the top | |
19 | //! | |
20 | //! ``` | |
21 | //! extern crate array_tool; | |
22 | //! ``` | |
23 | //! | |
24 | //! And if you plan to use all of the Vector helper methods available: | |
25 | //! | |
26 | //! ``` | |
27 | //! use array_tool::vec::*; | |
28 | //! ``` | |
29 | //! | |
30 | //! This crate is not limited to just Vector methods and has some helpful | |
31 | //! string methods as well. | |
32 | ||
33 | ||
34 | /// Array Tool provides useful methods for iterators | |
35 | pub mod iter; | |
36 | /// Array Tool provides many useful methods for vectors | |
37 | pub mod vec; | |
38 | /// A string is a collection so we should have more methods for handling strings. | |
39 | pub mod string; | |
40 | ||
41 | /// Get `uniques` from two vectors | |
42 | /// | |
43 | /// # Example | |
44 | /// ``` | |
45 | /// use array_tool::uniques; | |
46 | /// | |
47 | /// uniques(vec![1,2,3,4,5], vec![2,5,6,7,8]); | |
48 | /// ``` | |
49 | /// | |
50 | /// # Output | |
51 | /// ```text | |
52 | /// vec![vec![1,3,4], vec![6,7,8]] | |
53 | /// ``` | |
54 | pub fn uniques<T: PartialEq + Clone>(a: Vec<T>, b: Vec<T>) -> Vec<Vec<T>> { | |
55 | use self::vec::Uniq; | |
56 | vec![a.uniq(b.clone()), b.uniq(a)] | |
57 | } | |
58 |