Expand description

This crate provides a safe and convenient store for one value of each type.

Your starting point is Map. It has an example.

Cargo features

This crate has two independent features, each of which provides an implementation providing types Map, AnyMap, OccupiedEntry, VacantEntry, Entry and RawMap:

  • std (default, enabled in this build): an implementation using std::collections::hash_map, placed in the crate root (e.g. anymap::AnyMap).

  • hashbrown (optional; enabled in this build): an implementation using alloc and hashbrown::hash_map, placed in a module hashbrown (e.g. anymap::hashbrown::AnyMap).

Modules

AnyMap backed by hashbrown.

Structs

A collection containing zero or one values for any given type and allowing convenient, type-safe access to those values.

A view into a single occupied location in an Map.

A hasher designed to eke a little more speed out, given TypeId’s known characteristics.

A view into a single empty location in an Map.

Enums

A view into a single location in an Map, which may be vacant or occupied.

Traits

Any, but with cloning.

Type Definitions

The most common type of Map: just using Any; Map<dyn Any>.

Raw access to the underlying HashMap.