option-utils 0.1.0

A collection of utilities for working with Rust's Option type
Documentation
  • Coverage
  • 100%
    5 out of 5 items documented1 out of 5 items with examples
  • Size
  • Source code size: 4.22 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.12 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • jsoverson/option-utils
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jsoverson

option-utils

A collection of utilities for working with Rust's Option type

Example

use option_utils::OptionUtils;
let mut x = Some("Hello world".to_owned());
x.inner_mut(|s| s.push('!'));
assert_eq!(x, Some("Hello world!".to_owned()));

let path = Some("dir");
let path: Option<std::path::PathBuf> = path.map_into();
assert_eq!(path, Some(std::path::Path::new("dir").to_owned()));

let num = Some(10_u64);
let num: Option<u8> = num.try_map_into()?;
assert_eq!(num, Some(10_u8));```

## License

This project is licensed under the Apache-2.0 license.