3 releases

0.0.2 Jan 9, 2025
0.0.1 Jun 20, 2024
0.0.0 May 2, 2024

#500 in Algorithms

Download history 5/week @ 2024-09-25 1/week @ 2024-10-30 2/week @ 2024-11-06 1/week @ 2024-12-04 3/week @ 2024-12-11 156/week @ 2025-01-08

156 downloads per month

MIT/Apache

150KB
3K SLoC

blok

Types and traits for graphlike 3D arrays.

Usage

See example 1 for a basic demonstration of building with blocks.
See example 2 for a demonstration of procedural node connection.
See the crate documentation for explanations of specific types and methods.

Development

Blok is a work-in-progress. Current tasks can be tracked in TODO.md.

In 0.0.2

  • Stack, Layer, Row are all generic types
  • Added partial references
  • Connections no longer rely on clone
  • Connection methods moved to a Node subtrait
  • Alignments can be used on rows and layers during connection, as with blocks
  • Transformations temporarily removed

For 0.0.3

  • Improved transformations
  • Methods for removing blocks
  • Connection and disconnection fleshed out
  • Descriptive error types
  • 1-based array indexing
  • Tests and documentation improved
  • TBD...

Notes on style

  1. Variable names in function declarations generally use the name of the type (block, row, layer, etc.) when that type is expected as an argument, and will use the first letter of the type (b, r, l) when the argument expects a usize indicating the position of the corresponding element within a stack.
  2. Methods that "find" a block index using layouts will fail with an error. Methods that "get" references to blocks will treat that error as None, representing the failure to find the block as an absence.
  3. When building structures, blocks cannot be "inserted" at the last position of a row or layer, or in any other situation where the future location cannot be indexed as an existing block. In such a scenario, you must use a method that "adds" it to the structure, instead. Conventions like this exist for ease-of-development through the early stages and will be changed later on.
  4. The build process is designed to be similar at each level of construction, so if you are expecting to use a method that would correspond to another that exists for a different scale, but finding that it does not exist, then it is probable that the method or function has not been implemented yet. These corresponding methods will be fleshed out as the crate is refined, so that the build process will be intuitively similar for each of the types.

Dependencies

~0.7–1.4MB
~29K SLoC