Commit graph

1 commit

Author SHA1 Message Date
Jiahao XU
02fe3d4f27
Fix leon::ValuesFn: impl for Fn(&str) -> Option<Cow<'static, str>> (#998)
If we impl it for `<'f> Fn(&str) -> Option<Cow<'f, str>> + 'f`, then it would somehow imply it to `'static` when using it in `benches/values.rs` and `benches/others.rs`, thus I decided to simplify it back to only implement it for `'static` string.

Users who wants more flexibility should implement `Values` themselves.

This commit also extracts `benches` as a separate crate in an independent workspace to avoid building criterion and tinytemplate in CI, which makes it much slower as more crates need to be built and criterion actually pulls in clap, and a whole lots of other crates.

In additional to that, it:
 - Impl `leon::Values` for `Arc<T>` & `Rc<T>` where T: `Values`
 - Enable lto, abort on panic, stripping, set `codege-units` to 1 for `leon/benches`
 - Move into closure of criterion benchmark loop to reduce indirections
    which also reduce sizes of the closure since the Fns used in `ValuesFn`
    are zero-size.
    This also means that the compiler can now assumes `no-alias`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-26 13:17:41 +10:00