Cons
Convenience macros for the ConsList
type from the cons-list crate.
Usage
Add the following dependencies to your Cargo.toml
:
[]
= "0.0.3"
= "0.0.3"
Then add the following to your crate root:
extern crate cons;
extern crate cons_list;
The cons!
macro can be used as follows:
use ConsList;
// Create an empty ConsList
let list: = cons!;
// Create a ConsList with one element
let list = cons!;
// Prepend an element to a ConList
let head = "Hello";
let tail = cons!;
let list = cons!;
The conslist!
macro can be used as follows:
use ConsList;
// Create an empty ConsList
let list: = conslist!;
// Create a ConsList
let list = conslist!;