Expand description

Traits, helpers, and type definitions for the collection framework.

This module contains various tools for interacting with the collections. In summary:

  • Iterators is a trait that encapsulates all possible methods for iterating over a Collection.
  • Collection is the base trait all collections must implement. Defines a series of methods commonly used by almost all collections.
  • FixedSizeCollection is a trait that extends Collection and adds the ability to define collections with a fixed capacity and the possibility of expanding them. It is mainly intended for collections based on arrays.
  • ExpansionMode is a type that defines the behavior of a collection when it is full.
  • check_expansion is a function that checks if the collection is full and if it is, expands it depending on the ExpansionMode. Instead of using this function directly, the check_expansion_add macro is available to wrap the behavior of a function.

For more details, see the respective documentation of each item in the lists.

Enums

Different modes of action when the FixedSizeCollection is full. Depending on the mode, the collection will behave differently through the check_expansion method.

Traits

This is the trait that all implementations of a collection must implement. A Collection is a data structure that can be used to store a collection of items.
A Collection that can easily be expanded, as the capacity is fixed. Normally, this are data structures that use a fixed size buffer in memory (Array-like).
Trait that allows to implement all possible iterators over a Collection. All collections must implement all iterators, allowing for default implementations across collections.

Functions

Checks if the collection is full and if it is, expands the collection depending on the ExpansionMode. Also, returns true if the add method should finish execution.

Attribute Macros

This macro is used to check if the collection is expanded when it is full. This is used to ensure that the collection is expanded when it is full. This macro should be used in the implementation of the add method of the Collection trait if the collection also implements FixedSizeCollection.