Skip to content

Commit

Permalink
Update documentation about sep_by! in lib.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
TheVeryDarkness committed Oct 12, 2024
1 parent 95d916e commit 51e3343
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,21 @@
//!
//! ```rust
//! use iof::{sep_by, SepBy};
//! use std::f64::consts::*;
//!
//! let v = vec![1.0, 2.1, 3.2];
//! let s = sep_by!(&v, ", ");
//! assert_eq!(format!("{s:?}"), "1.0, 2.1, 3.2");
//!
//! let v = vec!["Alice", "Bob", "Charlie"];
//! let s = sep_by!(&v, ";");
//! assert_eq!(format!("{s:>10}"), " Alice; Bob; Charlie");
//! assert_eq!(format!("{s:<10}"), "Alice ;Bob ;Charlie ");
//!
//! let v = vec![E, PI, FRAC_1_PI, LN_2, LN_10, SQRT_2];
//! let s = sep_by!(&v, "");
//! assert_eq!(format!("{s:15.7}"), " 2.7182818 3.1415927 0.3183099 0.6931472 2.3025851 1.4142136");
//!
//! let v = vec![3735928559u32, 3405691582u32, 3405709037u32, 3435973836u32, 3452816845u32];
//! let s = sep_by!(&v, " ");
//! assert_eq!(format!("{s:x}"), "deadbeef cafebabe cafefeed cccccccc cdcdcdcd");
Expand Down

0 comments on commit 51e3343

Please sign in to comment.