spiral

Crates.iospiral
lib.rsspiral
version0.2.1
sourcesrc
created_at2017-12-21 20:18:09.009821
updated_at2024-02-09 21:02:14.042061
descriptionIterate over a 2D structure in a spiral pattern
homepagehttps://github.com/tversteeg/spiral
repositoryhttps://github.com/tversteeg/spiral.git
max_upload_size
id43885
size55,938
Thomas Versteeg (tversteeg)

documentation

https://docs.rs/spiral

README

spiral

Build Status Crates.io Documentation License: GPL-3.0 Downloads

Documentation

Iterators to iterate 2D structures in spiral patterns

Usage

This crate is on crates.io and can be used by adding spiral to the dependencies in your project's Cargo.toml.

[dependencies]
spiral = "0.2"

Examples

use spiral::ChebyshevIterator;

let center_x = 3;
let center_y = 3;
let radius = 4;
let iterator = ChebyshevIterator::new(center_x, center_y, radius);
for (x, y) in iterator {
    // Iterates over a 7x7 2D array with `x` & `y`.
}
use spiral::ManhattanIterator;

let center_x = 3;
let center_y = 3;
let radius = 4;
for (x, y) in ManhattanIterator::new(center_x, center_y, radius) {
    // Iterates over a 7x7 2D array with `x` & `y`.
}
Commit count: 54

cargo fmt