[][src]Module handy::typed

This module provides [TypedHandleMap][typed::TypedHandleMap] and [TypedHandle][typed::TypedHandle]. These are wrappers around of HandleMap and Handle which statically prevent trying to use a Handle returned from a HandleMap<T> to get a value out of a HandleMap<U>, instead of allowing it to fail at runtime, as it will with HandleMap.

For most use cases, this is probably not worth the extra trouble, but it's provided for completeness, and because the definition of TypedHandle has some subtle gotchas.

These abstractions are thin. Methods exist to go bidirectionally to and from both TypedHandleMap<T> to HandleMap<T> and TypedHandle<T> to Handle. You shouldn't need to do this, but restricting it seems needless.

Structs

TypedHandle

A TypedHandle is a wrapper around a Handle which gives you some additional type safety, should you desire. You use it with a TypedHandleMap, which only will accept handles of the correct type. This could be useful if you have several handle maps in your program, and find

TypedHandleMap

A TypedHandleMap is a wrapper around a HandleMap which gives you some additional type safety, should you desire.