handle.rs |
Well-typed indices into [`Arena`]s and [`UniqueArena`]s.
This module defines [`Handle`] and related types.
[`Arena`]: super::Arena
[`UniqueArena`]: super::UniqueArena |
3452 |
handle_set.rs |
The [`HandleSet`] type and associated definitions. |
2860 |
handlevec.rs |
The [`HandleVec`] type and associated definitions. |
2819 |
mod.rs |
! The [`Arena`], [`UniqueArena`], and [`Handle`] types.
To improve translator performance and reduce memory usage, most structures are
stored in an [`Arena`]. An `Arena<T>` stores a series of `T` values, indexed by
[`Handle<T>`](Handle) values, which are just wrappers around integer indexes.
For example, a `Function`'s expressions are stored in an `Arena<Expression>`,
and compound expressions refer to their sub-expressions via `Handle<Expression>`
values. (When examining the serialized form of a `Module`, note that the first
element of an `Arena` has an index of 1, not 0.)
A [`UniqueArena`] is just like an `Arena`, except that it stores only a single
instance of each value. The value type must implement `Eq` and `Hash`. Like an
`Arena`, inserting a value into a `UniqueArena` returns a `Handle` which can be
used to efficiently access the value, without a hash lookup. Inserting a value
multiple times returns the same `Handle`.
If the `span` feature is enabled, both `Arena` and `UniqueArena` can associate a
source code span with each element.
[`Handle<T>`]: Handle
|
10425 |
range.rs |
Well-typed ranges of [`Arena`]s.
This module defines the [`Range`] type, representing a contiguous range of
entries in an [`Arena`].
[`Arena`]: super::Arena |
4200 |
unique_arena.rs |
The [`UniqueArena`] type and supporting definitions. |
8158 |