mrdimidium / nanoid

A tiny, secure, URL-friendly, unique string ID generator for Rust
https://docs.rs/nanoid
MIT License
545 stars 29 forks source link

Accept any expression as the size argument #28

Closed alexkirsz closed 2 years ago

alexkirsz commented 2 years ago

Currently, the nanoid! macro only accepts a single token as its size argument. This means that expressions such as some_path::SIZE, compute_size(), and 42 / 2 will not compile.

This PR changes the macro to accept any expression as its size argument.

mrdimidium commented 2 years ago

Looks great, thanks! I will release a minor update with your patch a bit later.