Crate abstutil[][src]

Expand description

The contents of this crate need to be organized better:

  • Timer (a mix of logging, profiling, and even parallel execution)
  • true utility functions (collections, prettyprinting, CLI parsing

Re-exports

pub use logger::*;
pub use time::*;

Modules

Structs

A counter per key

A drop-in replacement for BTreeMap, where the keys have the property of being array indices. Some values may be missing. Much more efficient at operations on individual objects, because it just becomes a simple array lookup.

Convenience functions around a string->string map

Use when your key is just PartialEq, not Ord or Hash.

Constants

Traits

Trick to make a cloneable Any from https://stackoverflow.com/questions/30353462/how-to-clone-a-struct-storing-a-boxed-trait-object/30353928#30353928.

Use with FixedMap. From a particular key, extract a usize. These values should be roughly contiguous; the space used by the FixedMap will be O(n) with respect to the largest value returned here.

Functions

Transforms some command-line arguments into URL query parameters, using & as the separator between arguments. The string returned starts with ?, unless the arguments are all empty.

Returns arguments passed in from the command-line, starting with the program name.

Deserializes a BTreeMap from a list of tuples. Necessary when the keys are structs; see https://github.com/serde-rs/json/issues/402.

Deserializes a HashMap from a list of tuples.

Deserializes a MultiMap.

Deserializes a usize from a u32.

Deserializes an object from the bincode format.

Deserializes an object from the bincode format, from a reader.

Deserializes an object from a JSON string.

Deserializes an object from JSON, from a reader.

Runs a command, asserts success. STDOUT and STDERR aren’t touched.

Serializes a BTreeMap as a list of tuples. Necessary when the keys are structs; see https://github.com/serde-rs/json/issues/402.

Serializes a HashMap as a list of tuples, first sorting by the keys. This ensures the serialized form is deterministic.

Serializes a MultiMap.

Serializes a usize as a u32 to save space. Useful when you need usize for indexing, but the values don’t exceed 2^32.

The number of bytes for an object serialized to bincode.

Transforms an object to bincoded bytes.

Stringifies an object to nicely formatted JSON.

Stringifies an object to terse JSON.