9 releases (5 breaking)

0.6.1 Nov 16, 2022
0.5.1 Nov 16, 2022
0.5.0 Nov 28, 2021
0.4.0 Mar 29, 2021
0.1.1 Oct 24, 2019

#11 in No standard library

Download history 488837/week @ 2023-12-15 284862/week @ 2023-12-22 384646/week @ 2023-12-29 537985/week @ 2024-01-05 534199/week @ 2024-01-12 563146/week @ 2024-01-19 566062/week @ 2024-01-26 569440/week @ 2024-02-02 582640/week @ 2024-02-09 524925/week @ 2024-02-16 559424/week @ 2024-02-23 582422/week @ 2024-03-01 579163/week @ 2024-03-08 615149/week @ 2024-03-15 600839/week @ 2024-03-22 480508/week @ 2024-03-29

2,379,114 downloads per month
Used in 3,049 crates (7 directly)

MIT license

650 lines


myrrlyn’s wyzyrdly library

Latest Version MSRV License

Documentation Crate Downloads

I have developed a collection of utility and convenience Rust modules that are useful to me, and may be useful to you also.

This crate is a collection of largely-independent small modules. I do not currently offer features to disable modules independently of each other, but their compilation cost is small enough to essentially not matter.


  1. bidi
  2. exit
  3. fmt
  4. range


This provides an extension trait for DoubleEndedIterator with a method, .bidi(cond: bool), that sets whether the iterator operates in forward or reverse by the runtime condition. When the condition is true, forward iteration (with .next(), .nth()) forwards to the equivalent reverse methods (.next_back(), .nth_back()) and vice-versa; when the condition is false, iteration behaves normally.

This only checks the condition upon initial creation; it is otherwise branchless.


This is a macro that calls std::process::exit. It can return a status code, and also print a message to stderr.

use wyz::exit::exit;

exit!(3, "This is a {} message", "failure");

The default call is std::process::exit(1); a call may provide its own exit code and, in addition, a set of arguments to pass directly to eprintln!. The error message is not guaranteed to be emitted, as stderr may be closed at time of exit!.


Rust uses the Debug trait for automatic printing events in several parts of the standard library. This module provides wrapper types which forward their Debug implementation to a specified other formatting trait. It also implements extension methods on all types that have format trait implementations to wrap them in the corresponding shim type.

use wyz::fmt::FmtForward as _;

let val = 6;
let addr = &val as *const i32;
println!("{:?}", addr.fmt_pointer());

This snippet uses the Debug format template, but will print the Pointer implementation of *const i32.

This is useful for fitting your values into an error-handling framework that only uses Debug, such as the fn main() -> Result program layout.

In addition to forwarding each of the scalar traits, this also provides a .fmt_list() that formats any type T where &T: IntoIterator as a list. The list-formatting adapter itself implements all of the scalar formatting traits, and can also be wrapped in any of the forwarding guards so that it can be sent to a Debug sink:

use wyz::fmt::FmtForward as _;

let seq = 0 .. 4;
  format!("{:02b}", seq.fmt_list()),
  "[00, 01, 10, 11]",
      .map(|x| (x + 1) * 10)
  "[a, 14, 1e, 28]",


This provides an extension trait, RangeExt, on RangeBounds. It is currently only used with R: RangeBounds<usize>, again because it is an MVP for bitvec’s use rather than a project in its own right. It normalizes arbitrary ranges into the Range concrete type. PRs welcome!