radicle-heartwood-lfs/crates/radicle/src/cob
Matthias Beyer b49ff9e5af radicle: Implement Iterator::size_hint() for optimizations
This patch adds an implementation of the Iterator::size_hint() trait
function so that the compiler can optimize allocations on the collecting
side of the iterator better.

From the trait function docs:

> size_hint() is primarily intended to be used for optimizations such
> as reserving space for the elements of the iterator, but must not be
> trusted to e.g., omit bounds checks in unsafe code. An incorrect
> implementation of size_hint() should not lead to memory safety
> violations.

Source: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.size_hint

And:

> Vec may use any or none of the following strategies, depending on the
> supplied iterator:
>
>  *  preallocate based on Iterator::size_hint() and panic if the number
>     of items is outside the provided lower/upper bounds

Source: https://doc.rust-lang.org/stable/std/iter/trait.FromIterator.html

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-08-17 20:22:56 +02:00
..
cache repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
issue radicle: Implement Iterator::size_hint() for optimizations 2025-08-17 20:22:56 +02:00
patch radicle: add ReviewEdit getter methods 2025-07-15 09:55:45 +01:00
cache.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
common.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
external.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
identity.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
issue.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
op.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
patch.rs radicle: Fix clippy::result_large_err 2025-07-27 23:32:39 +02:00
store.rs radicle: remove unnecessary constraints 2025-07-08 11:36:42 +02:00
test.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00
thread.rs repo: Move workspace crates into `crates` subdirectory 2025-06-09 15:09:21 +02:00