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
57
58
59
60
//! Safe memory comparison between types.
//!
//! Types found in this crate serve as safe wrappers around `memcmp` operations.
//!
//! # Usage
//!
//! This crate is available [on crates.io][crate] and can be used by adding the
//! following to your project's `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! mem_cmp = "0.1.2"
//! ```
//!
//! and this to your crate root:
//!
//! ```
//! extern crate mem_cmp;
//! # fn main() {}
//! ```
//!
//! # Comparing Memory
//!
//! The [`MemOrd`] trait provides convenience around the result of a `memcmp`
//! call by returning an `Ordering`.
//!
//! If the only thing that matters is equality, [`MemEq`] is also available.
//!
//! ```
//! # extern crate mem_cmp;
//! # fn main() {
//! use mem_cmp::*;
//!
//! let a = [0u8; 256];
//! let b = [0u32; 64];
//! let c = [4u32; 64];
//!
//! assert!(a.mem_eq(&b));
//! assert!(a.mem_neq(&c));
//!
//! // Also works with types of different sizes:
//! assert!(a.mem_neq(&42));
//! # }
//! ```
//!
//! [crate]: https://crates.io/crates/mem_cmp
//! [`MemEq`]: trait.MemEq.html
//! [`MemOrd`]: trait.MemOrd.html

#![cfg_attr(feature = "specialization", feature(specialization))]
#![no_std]

mod ext;
mod mem_eq;
mod mem_ord;
mod mem_ordered;

pub use mem_eq::*;
pub use mem_ord::*;
pub use mem_ordered::*;