1 // Copyright 2015-2016 Brian Smith.
2 //
3 // Permission to use, copy, modify, and/or distribute this software for any
4 // purpose with or without fee is hereby granted, provided that the above
5 // copyright notice and this permission notice appear in all copies.
6 //
7 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
8 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
10 // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 
15 //! Polyfills for functionality that will (hopefully) be added to Rust's
16 //! standard library soon.
17 
18 #[inline(always)]
u64_from_usize(x: usize) -> u6419 pub const fn u64_from_usize(x: usize) -> u64 {
20     x as u64
21 }
22 
usize_from_u32(x: u32) -> usize23 pub fn usize_from_u32(x: u32) -> usize {
24     x as usize
25 }
26 
27 #[macro_use]
28 mod chunks_fixed;
29 
30 mod array_flat_map;
31 
32 #[cfg(feature = "alloc")]
33 mod leading_zeros_skipped;
34 
35 #[cfg(test)]
36 mod test;
37 
38 mod unwrap_const;
39 
40 pub use self::{array_flat_map::ArrayFlatMap, chunks_fixed::*, unwrap_const::unwrap_const};
41 
42 #[cfg(feature = "alloc")]
43 pub use leading_zeros_skipped::LeadingZerosStripped;
44