Crate ergo_std [] [src]

ergo_std: items that could be in the standard library.

This is the "core types" library as part of the ergo crates ecosystem. It contains useful types, traits and functions for general purpose programming projects which do not fall into the other ergo crates but which are boons to ergonomics and productivity.

How to Use

In your Cargo.toml

ergo_std = "0.1"
serde = "1.0"
serde_derive = "1.0"

You have to put the other crates in your Cargo.toml in order for #[derive(...)] to work correctly.

#[macro_use] extern crate ergo_std;
use ergo_std::*;
fn main() {
    /* Your code goes here */

Exported Items

The following crates and types are exported. See their docs for how to use them.

  • std_prelude: extends rust's std::prelude with commonly used types. The crate is well documented with justification and usecases for each type.
  • [serde]: the defacto serialization library of rust. Also imports serde_derive so you can use #[derive(Serialize, Deserialize)].
  • lazy_static!: the lazy_static! macro is the current standard way to create global variables and constants. Warning that they are created lazily (at run time)!
  • itertools: the itertools prelude provides traits that extends rust's already extensive iterator API.
  • indexmap: indexable and sortable map and set types with similar performance to std types and beter performance when iterating.
  • maplit: provides hashmap!, hashset!, btreemap! and btreeset! macros to compliment rust's existing vec! macro. These
  • Regex: the regular expression type from the regex crate.

Special thanks

The crates that are exported are:

  • serde: Serialization framework for Rust
  • std_prelude: prelude that the rust stdlib should have always had
  • lazy_static: A small macro for defining lazy evaluated static variables in Rust.
  • itertools: Extra iterator adaptors, iterator methods, free functions, and macros.
  • indexmap: A hash table with consistent order and fast iteration (previously named ordermap)
  • maplit: Rust container / collection literal macros for HashMap, HashSet, BTreeMap, BTreeSet.
  • regex: An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.

Consider supporting their development individually and starring them on github.


pub extern crate itertools;
pub extern crate indexmap;
pub extern crate lazy_static;
pub extern crate maplit;
pub extern crate std_prelude;
pub extern crate regex;
pub extern crate serde;
pub extern crate serde_derive;
pub use std_prelude::*;
pub use lazy_static::*;
pub use indexmap::*;
pub use maplit::*;
pub use serde::*;
pub use serde_derive::*;



Create a BTreeMap from a list of key-value pairs


Create a BTreeSet from a list of elements.


Macro that converts the keys or key-value pairs passed to another maplit macro. The default conversion is to use the Into trait, if no custom conversion is passed.


Helper macro when implementing the Deserializer part of a new data format for Serde.


Create a HashMap from a list of key-value pairs


Create a HashSet from a list of elements.


Create an IndexMap from a list of key-value pairs


Create an IndexSet from a list of values




A compiled regular expression for matching Unicode strings.



The trait Itertools: extra iterator adaptors and methods for iterators.