Crate table

Source
Expand description

The Table is a dynamic, compound data type that is designed to be able to represent any kind of structured data. This is especially useful in cases where the structure of data can’t be precisely known at compile-time.

Tables contain Values that are indexed by Keys, both being enums that define the types that are valid for each use case. Key tends to be a limited subset of Value: some types represented by Value aren’t hashable, but there aren’t many Key types that wouldn’t also make sense as a Value type.

The second, maybe-equally-important data type is the List, an ordered, contiguous sequence of values that may be indexed similar to Table but is limited to nonnegative integer keys. Lists are always indexed starting at zero (0); since they are also contiguous, the range of indices of a List with length n is 0..n.

While the crate is named after its Table data type, Values are just as useful, if not more, since they can be tables themselves along with any of the primitive types. The Value type is also fully compatible with serde; it acts as both a (de)serializable and a (de)serializer, meaning it is an intermediate data format that can be converted to/from other data formats and to/from other (de)serializables. This makes it useful as a format for storing arbitrary data from any other format like JSON, YAML, or TOML.

§License

Copyright (C) 2018 Project Tsukurou!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Modules§

  • Structs and utilities offered by the List API.
  • Structs and utilities offered by the Table API.
  • Utilities not directly related to the functionality of this crate, but not provided by an upstream crate.

Structs§

  • The crate’s common error type.
  • An ordered sequence of value elements.
  • An unordered collection of key-value pairs.

Enums§

  • Defines the types that can be used to index into a table.
  • Defines the types of data that can be stored in a table.