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

[dependencies]
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.

Re-exports

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::*;

Macros

btreemap

Create a BTreeMap from a list of key-value pairs

btreeset

Create a BTreeSet from a list of elements.

convert_args

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.

forward_to_deserialize_any

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

hashmap

Create a HashMap from a list of key-value pairs

hashset

Create a HashSet from a list of elements.

indexmap

Create an IndexMap from a list of key-value pairs

indexset

Create an IndexSet from a list of values

lazy_static

Structs

Regex

A compiled regular expression for matching Unicode strings.

Traits

Itertools

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