All Projects → peterjoel → velcro

peterjoel / velcro

Licence: MIT license
Collection initialization macros for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to velcro

Sc
Common libraries and data structures for C.
Stars: ✭ 161 (+257.78%)
Mutual labels:  vector, hashmap
rrbit
An Immutable vectors/lists/arrays library using the Relaxed Radix Balancing(RRB) technique
Stars: ✭ 12 (-73.33%)
Mutual labels:  collection, vector
Tstl
TypeScript-STL (Standard Template Library, migrated from C++)
Stars: ✭ 397 (+782.22%)
Mutual labels:  collection, hashmap
indicium
🔎 A simple in-memory search for collections and key-value stores.
Stars: ✭ 41 (-8.89%)
Mutual labels:  collection, hashmap
Containers
This library provides various containers. Each container has utility functions to manipulate the data it holds. This is an abstraction as to not have to manually manage and reallocate memory.
Stars: ✭ 125 (+177.78%)
Mutual labels:  collection, vector
Harbol
Harbol is a collection of data structure and miscellaneous libraries, similar in nature to C++'s Boost, STL, and GNOME's GLib
Stars: ✭ 18 (-60%)
Mutual labels:  vector, hashmap
go-streams
Stream Collections for Go. Inspired in Java 8 Streams and .NET Linq
Stars: ✭ 127 (+182.22%)
Mutual labels:  collection
avatarmake
Easily make your own cartoon avatar base on d3.js
Stars: ✭ 34 (-24.44%)
Mutual labels:  vector
toolkit
some useful library of the php
Stars: ✭ 15 (-66.67%)
Mutual labels:  collection
Stretch
KiCad to SVG and then back again
Stars: ✭ 56 (+24.44%)
Mutual labels:  vector
Java-CS-Record
记录准备春招实习过程中,学习与复习的知识(模块化整理,非面试题速成)。注:暂停更新,后续请移步博客
Stars: ✭ 73 (+62.22%)
Mutual labels:  collection
CuVec
Unifying Python/C++/CUDA memory: Python buffered array ↔️ `std::vector` ↔️ CUDA managed memory
Stars: ✭ 73 (+62.22%)
Mutual labels:  vector
links-uteis
📎 A curated list of awesome project development links
Stars: ✭ 2,547 (+5560%)
Mutual labels:  collection
SuperformulaSVG
2D superformula line-art generator built in Processing, with SVG export for use in digital fabrication workflows.
Stars: ✭ 40 (-11.11%)
Mutual labels:  vector
vectorshapes-unity
Library for drawing vector shapes in Unity.
Stars: ✭ 44 (-2.22%)
Mutual labels:  vector
vec-la-fp
↗️ A tiny (functional) 2d linear algebra library
Stars: ✭ 21 (-53.33%)
Mutual labels:  vector
BitLens
🔎 Have your bits and eat them too! A C++17 bit lens container for vector types.
Stars: ✭ 20 (-55.56%)
Mutual labels:  vector
glm
OpenGL Mathematics (GLM)
Stars: ✭ 6,667 (+14715.56%)
Mutual labels:  vector
hack
Kubernetes security and vulnerability tools and utilities.
Stars: ✭ 56 (+24.44%)
Mutual labels:  vector
vector
A PHP functional programming library.
Stars: ✭ 19 (-57.78%)
Mutual labels:  vector

Velcro

Build Status

A set of macros for conveniently initializing collections from Rust's std and iterators. All of the macros support the unary .. operator which "spreads" the values of another collection or iterator.

velcro::vec! is a drop-in replacement for std::vec!. All functionality of the std macro is supported without overhead, but it also supports spreading values with the .. operator.

Examples

use velcro::{hash_map, iter, vec};

assert_eq!(vec![0, 1, ..(2..7)], vec![0, 1, 2, 3, 4, 5, 6]);

let other = vec![3, 4, 5];
assert_eq!(vec![0, 1, 2, ..&other, 6], vec![0, 1, 2, 3, 4, 5, 6]);

let whitespace = iter![' ', '\t', '\r', '\n'];
let map = hash_map! {
    ..('0'..='9'): "digit",
    ..('a'..='z'): "lower",
    ..('A'..='Z'): "upper",
    ..whitespace: "whitespace",
    '.': "punctuation",
    ',': "punctuation",
};

assert_eq!(map[&'x'], "lower");
assert_eq!(map[&'\r'], "whitespace");
assert_eq!(map[&'.'], "punctuation");

Help

For help, questions or to report an issue, please use the Github issue tracker.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].