I just published a small crate to crates.io which provide the `Bc<T>`

type. This type only count the number of time the underlying value has been mutably borrowed.

My initial motivation for building this is in the README, which I quote here:

If you want to cache an expensive computation result, you need to have

information about wether the parameters of the computation have changed or

not. You can use a hash for that, but this have two shortcomings:

- You need to have values which implement the Hash trait. Some useful

types like f64 do not;- You need to have a cheap way to compute the hash.
If computing the hash is harder or more expensive than doing the

computation, you are doomed. Or you can use Bc which will give you

information about the number of borrow since the last computation. If this

number have changed, then it is very likely that the value have changed,

and that you need to redo your computation.

That's why I only count mutables borrow. But now I wonder if there could be any other use case for borrow counted types, either counting only immutables borrow or counting both mutables and immutables borrow.

Do you have any insight on this question ?

Cheers,

Luthaf