stdx

Module anymap

source
Expand description

This file is a port of only the necessary features from https://github.com/chris-morgan/anymap version 1.0.0-beta.2 for use within rust-analyzer. Copyright © 2014–2022 Chris Morgan. COPYING: https://github.com/chris-morgan/anymap/blob/master/COPYING Note that the license is changed from Blue Oak Model 1.0.0 or MIT or Apache-2.0 to MIT OR Apache-2.0

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

Your starting point is Map. It has an example.

§Cargo features

This implementation 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).

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§

  • Methods for downcasting from an Any-like trait object.
  • A trait for the conversion of an object into a boxed trait object.

Type Aliases§

  • The most common type of Map: just using Any; Map<dyn Any>.
  • Raw access to the underlying HashMap.