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

API 2.0 #6

Open ai opened 6 years ago

ai commented 6 years ago

Let’s update the library to be compatible with the latest Nano ID 2.0:

mrdimidium commented 6 years ago

How do you see async in Rust? We have event-loop, and any operation is performed synchronously

ai commented 6 years ago

It is questionable part depends on a programming language. Maybe it should not be implemented in Rust.

But what about event-loop based framework which we talk about in Logux issue?

mrdimidium commented 6 years ago

It seems to me that to bring a big Tokio for small nanoid is inadmissible. It seems to me that in the reality of Rust, it is better for the user to decide how he organizes the asynchrony

ai commented 6 years ago

it is better for the user to decide how he organizes the asynchrony

👍

naturallymitchell commented 5 years ago

I like your plan to let users decide asynchrony. That makes sense to me too.

The non-secure generator would be a nice feature, so I'll keep an eye out for that. Maybe changing this issue to just track that would fit since it's the only remaining task.

Thank you

sorcix commented 2 years ago

I like that the Uuid crate has a Uuid type that just stores the random bytes. If you're planning to change the API, something like this would be nice to have. It improves performance when using the NanoID as the key in object stores that don't use String keys.

tmccombs commented 1 year ago

Maybe also change the API of the random generator to be FnMut(&mut [u8]) so that a new vec doesn't have to be allocated each time more random data is needed.