dylanhart / ulid-rs

This is a Rust implementation of the ulid project
https://crates.io/crates/ulid
MIT License
389 stars 37 forks source link

Relax the `Sized` requirement on the random source generic #56

Closed sandhose closed 1 year ago

sandhose commented 1 year ago

This removes the Sized requirement on the random source generic. I need this because &dyn Traits are not !Sized, so the following code would not work before, but it does now:

fn f(rng: &mut dyn RngCore, now: SystemTime) -> Ulid {
    Ulid::from_datetime_with_source(now, rng)
}

fn main() {
    f(&mut rand::thread_rng(), SystemTime::now());
}
sandhose commented 1 year ago

@dylanhart Thanks for the merge! Would you mind releasing a new version with it included? I currently have to override the ulid dependency in my project – which is fine –, but I'd like to get back to a version released on crates.io rather sooner than later