underscore 0.0.2

utility library for rust. Inspired by underscore.js.
docs.rs failed to build underscore-0.0.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

overview

underscore-rust is utility library for rust. Inspired by underscore.js.

usage

underscore-rust expands std library. You can use the same as standard library.

pub use underscore::vec::VecU;

let sample = vec!(1i, 2, 3);
assert_eq!(1i, *sample.first().unwrap());
pub use underscore::hashmap::HashMapU;

let mut sample = HashMap::new();
sample.insert(1i, 1u);
sample.insert(2i, 2u);
let inverted = sample.invert();
// => HashMap { 1u: 1i, 2u: 2i }
pub use underscore::vec::BTreeMapU;

let mut sample = BTreeMap::new();
sample.insert(1i, 1u);
sample.insert(2i, 2u);
let inverted = sample.invert();
// => BTreeMap { 1u: 1i, 2u: 2i }

underscore-rust now expands only Vec, HashMap, BTreeMap.

document

detail document is here.

std library

rust already has many functions of underscore.js at std library. If you are looking for them, take a look at official document.

underscore-rust appends below functions.

  • pairs
  • invert
  • pick
  • omit
  • defaults
  • first
  • without
  • intersection
  • uniq
  • indexOf
  • lastIndexOf