assertables/assert_starts_with/mod.rs
1//! Assert for a sequence that may start with a part.
2//!
3//! These macros help with comparison of a sequence (such as a string, vector, range)
4//! and a part (such as a string substring, an array element, a range value).
5//!
6//! * [`assert_starts_with(sequence, subsequence)`](macro@crate::assert_starts_with) ≈ container.contains(containee)
7//!
8//! * [`assert_not_starts_with!(sequence, subsequence)`](macro@crate::assert_not_starts_with) ≈ !container.contains(containee)
9//!
10//! # Example
11//!
12//! ```rust
13//! use assertables::*;
14//!
15//! // String starts with substring?
16//! let sequence: &str = "alfa";
17//! let subsequence: &str = "al";
18//! assert_starts_with!(sequence, subsequence);
19//!
20//! // Vector starts with element?
21//! let sequence = vec![1, 2, 3];
22//! let subsequence = [1];
23//! assert_starts_with!(sequence, subsequence);
24//! ```
25
26pub mod assert_not_starts_with;
27pub mod assert_starts_with;